]> git.meshlink.io Git - catta/commitdiff
small fix that speeds up destruction of AvahiClient objects. We will now simply termi...
authorLennart Poettering <lennart@poettering.net>
Fri, 20 Jan 2006 21:20:42 +0000 (21:20 +0000)
committerLennart Poettering <lennart@poettering.net>
Fri, 20 Jan 2006 21:20:42 +0000 (21:20 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1090 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-client/client.c

index 2f9b870cc9e1cad1fdb3f96a147126b9f0b92394..4ee8e41690a2e6fdaf65fe748077392ab2f28124 100644 (file)
@@ -595,6 +595,11 @@ fail:
 void avahi_client_free(AvahiClient *client) {
     assert(client);
 
+    if (client->bus)
+        /* Disconnect in advance, so that the free() functions won't
+         * issue needless server calls */
+        dbus_connection_disconnect(client->bus);
+    
     while (client->groups)
         avahi_entry_group_free(client->groups);
 
@@ -619,10 +624,8 @@ void avahi_client_free(AvahiClient *client) {
     while (client->record_browsers)
         avahi_record_browser_free(client->record_browsers);
     
-    if (client->bus) {
-        dbus_connection_disconnect(client->bus);
+    if (client->bus)
         dbus_connection_unref(client->bus);
-    }
 
     avahi_free(client->version_string);
     avahi_free(client->host_name);
@@ -859,5 +862,7 @@ fail:
 int avahi_client_is_connected(AvahiClient *client) {
     assert(client);
 
-    return client->state == AVAHI_CLIENT_S_RUNNING || client->state == AVAHI_CLIENT_S_REGISTERING || client->state == AVAHI_CLIENT_S_COLLISION;
+    return
+        dbus_connection_get_is_connected(client->bus) &&
+        (client->state == AVAHI_CLIENT_S_RUNNING || client->state == AVAHI_CLIENT_S_REGISTERING || client->state == AVAHI_CLIENT_S_COLLISION);
 }