summaryrefslogtreecommitdiff
path: root/client/gvfsdaemondbus.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@src.gnome.org>2007-09-13 11:20:13 +0000
committerAlexander Larsson <alexl@src.gnome.org>2007-09-13 11:20:13 +0000
commit91c89c59215f5223e623f8a3ee6bf00d4c31a4f6 (patch)
tree2960fe40aa6df05b1c76492033414289b6f8caab /client/gvfsdaemondbus.c
parentcb546a903e612d8b3e00137ea7a82ef10a6e808c (diff)
downloadgvfs-91c89c59215f5223e623f8a3ee6bf00d4c31a4f6.tar.gz
Clean up code a bit
Original git commit by Alexander Larsson <alex@greebo.(none)> at 1170168588 +0100 svn path=/trunk/; revision=286
Diffstat (limited to 'client/gvfsdaemondbus.c')
-rw-r--r--client/gvfsdaemondbus.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/client/gvfsdaemondbus.c b/client/gvfsdaemondbus.c
index a1612909..568fcaa6 100644
--- a/client/gvfsdaemondbus.c
+++ b/client/gvfsdaemondbus.c
@@ -23,6 +23,8 @@
typedef struct {
int extra_fd;
int extra_fd_count;
+
+ /* Only used for async connections */
GHashTable *outstanding_fds;
GSource *extra_fd_source;
} VfsConnectionData;
@@ -40,7 +42,7 @@ G_LOCK_DEFINE_STATIC(async_map);
static GHashTable *obj_path_map = NULL;
G_LOCK_DEFINE_STATIC(obj_path_map);
-static void setup_async_fd_receive (VfsConnectionData *connection_data);
+static void setup_async_fd_receive (VfsConnectionData *connection_data);
static gpointer
vfs_dbus_init (gpointer arg)
@@ -105,6 +107,7 @@ vfs_connection_filter (DBusConnection *connection,
callback = NULL;
data = NULL;
+
G_LOCK (obj_path_map);
if (obj_path_map)
{
@@ -299,7 +302,7 @@ _g_dbus_connection_get_fd_async (DBusConnection *connection,
}
/*******************************************************************
- * Handling of async connections *
+ * Caching of async connections *
*******************************************************************/
@@ -320,11 +323,20 @@ get_connection_for_async (const char *dbus_id)
}
static void
+close_and_unref_connection (void *data)
+{
+ DBusConnection *connection = data;
+
+ dbus_connection_close (connection);
+ dbus_connection_unref (connection);
+}
+
+static void
set_connection_for_async (DBusConnection *connection, const char *dbus_id)
{
G_LOCK (async_map);
if (async_map == NULL)
- async_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)dbus_connection_unref);
+ async_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, close_and_unref_connection);
g_hash_table_insert (async_map, g_strdup (dbus_id), connection);
dbus_connection_ref (connection);