summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-01-20 21:20:42 +0000
committerLennart Poettering <lennart@poettering.net>2006-01-20 21:20:42 +0000
commit1463c6f70a4755ddbf447c00aacb78c66852424e (patch)
tree60cad4106307dde3ae1a7f02031937062f19c054
parent01a71ceb27a06747075c320613184d729167980a (diff)
small fix that speeds up destruction of AvahiClient objects. We will now simply terminate the DBUS connection before freeing local objects. This way the number of server calls is decreased. The server will clean up the client objects anyway if the connection is closed, hence there is no need to do that manually from the client side.
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1090 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
-rw-r--r--avahi-client/client.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/avahi-client/client.c b/avahi-client/client.c
index 2f9b870..4ee8e41 100644
--- a/avahi-client/client.c
+++ b/avahi-client/client.c
@@ -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);
}