Make d-bus version detection work for >= 1.0 (Closes: #71)
authorTrent Lloyd <lathiat@bur.st>
Sat, 11 Nov 2006 00:00:20 +0000 (00:00 +0000)
committerTrent Lloyd <lathiat@bur.st>
Sat, 11 Nov 2006 00:00:20 +0000 (00:00 +0000)
Dont dbus_connection_close on shared dbus connections (Closes: #68)

git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1333 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-daemon/dbus-protocol.c

index dbf30f8..caa2e19 100644 (file)
@@ -1067,10 +1067,10 @@ static int dbus_connect(void) {
     if (dbus_bus_request_name(
             server->bus,
             AVAHI_DBUS_NAME,
-#if (DBUS_VERSION_MAJOR == 0) && (DBUS_VERSION_MINOR >= 60)
-            DBUS_NAME_FLAG_DO_NOT_QUEUE,
-#else
+#if (DBUS_VERSION_MAJOR == 0) && (DBUS_VERSION_MINOR < 60)
             DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT,
+#else
+            DBUS_NAME_FLAG_DO_NOT_QUEUE,
 #endif
             &error) != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
         if (dbus_error_is_set(&error)) {
@@ -1106,11 +1106,6 @@ fail:
         dbus_error_free(&error);
 
     if (server->bus) {
-#ifdef HAVE_DBUS_CONNECTION_CLOSE
-        dbus_connection_close(server->bus);
-#else
-        dbus_connection_disconnect(server->bus);
-#endif
         dbus_connection_unref(server->bus);
         server->bus = NULL;
     }
@@ -1127,11 +1122,6 @@ static void dbus_disconnect(void) {
     assert(server->n_clients == 0);
 
     if (server->bus) {
-#ifdef HAVE_DBUS_CONNECTION_CLOSE
-        dbus_connection_close(server->bus);
-#else
-        dbus_connection_disconnect(server->bus);
-#endif
         dbus_connection_unref(server->bus);
         server->bus = NULL;
     }
@@ -1166,11 +1156,6 @@ int dbus_protocol_setup(const AvahiPoll *poll_api, int _disable_user_service_pub
 
 fail:
     if (server->bus) {
-#ifdef HAVE_DBUS_CONNECTION_CLOSE
-        dbus_connection_close(server->bus);
-#else
-        dbus_connection_disconnect(server->bus);
-#endif
         dbus_connection_unref(server->bus);
     }