summaryrefslogtreecommitdiff
path: root/daemon/gvfschannel.c
diff options
context:
space:
mode:
authorChristian Kellner <gicmo@gnome.org>2011-06-05 12:57:02 +0200
committerChristian Kellner <gicmo@gnome.org>2011-06-06 14:40:45 +0200
commite078f0e75203969ef4c7bcbc61bd935d65316cc9 (patch)
treebf4a34795ff0670f9f6042fcbfc3936c255540cb /daemon/gvfschannel.c
parent16db079fe3eb5c9083cc4d4649bdbaff55e43bbf (diff)
downloadgvfs-e078f0e75203969ef4c7bcbc61bd935d65316cc9.tar.gz
daemon: Add logic to force close active channels
This includes logic in a GVfsChannel to force close is as well as a function in the GVfsDaemon to iterate over all active channels and call the force-close function.
Diffstat (limited to 'daemon/gvfschannel.c')
-rw-r--r--daemon/gvfschannel.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/daemon/gvfschannel.c b/daemon/gvfschannel.c
index b5e3d6a7..931a857d 100644
--- a/daemon/gvfschannel.c
+++ b/daemon/gvfschannel.c
@@ -750,3 +750,32 @@ g_vfs_channel_get_actual_consumer (GVfsChannel *channel)
return channel->priv->actual_consumer;
}
+static void
+free_queued_requests (gpointer data)
+{
+ Request *req = (Request *) data;
+
+ g_free (req->data);
+ g_free (req);
+}
+
+void
+g_vfs_channel_force_close (GVfsChannel *channel)
+{
+ GVfsJob *job;
+ gint fd;
+
+ fd = g_unix_input_stream_get_fd (G_UNIX_INPUT_STREAM (channel->priv->command_stream));
+
+ shutdown (fd, SHUT_RDWR);
+
+ job = channel->priv->current_job;
+
+ if (job)
+ g_vfs_job_cancel (job);
+
+ g_list_free_full (channel->priv->queued_requests, free_queued_requests);
+ channel->priv->queued_requests = NULL;
+
+ g_vfs_job_source_closed (G_VFS_JOB_SOURCE (channel));
+}