]> err.no Git - systemd/commitdiff
dbus: send reload completion message on right connection
authorLennart Poettering <lennart@poettering.net>
Wed, 7 Jul 2010 00:21:16 +0000 (02:21 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 7 Jul 2010 00:21:42 +0000 (02:21 +0200)
src/dbus-manager.c
src/dbus.c
src/manager.h

index cd6a975bfcd2897ea7efba36b815f050a2e055c1..7bf58b392c9bb172219a674f453c98df12f793ad 100644 (file)
@@ -641,6 +641,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                 if (!(m->queued_message = dbus_message_new_method_return(message)))
                         goto oom;
 
+                m->queued_message_connection = connection;
                 m->exit_code = MANAGER_RELOAD;
 
         } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "Reexecute")) {
index 6660cf0c5a7ed77d0ecd956fbe327f24905a2640..576f7850b244ab11b01c8241e55f8d3f89f0bfd3 100644 (file)
@@ -496,12 +496,13 @@ unsigned bus_dispatch(Manager *m) {
                  * dispatch any D-Bus messages, so that we won't end
                  * up wanting to queue another message. */
 
-                if (m->api_bus)
-                        if (!dbus_connection_send(m->api_bus, m->queued_message, NULL))
+                if (m->queued_message_connection)
+                        if (!dbus_connection_send(m->queued_message_connection, m->queued_message, NULL))
                                 return 0;
 
                 dbus_message_unref(m->queued_message);
                 m->queued_message = NULL;
+                m->queued_message_connection = NULL;
         }
 
         if ((c = set_first(m->bus_connections_for_dispatch))) {
@@ -991,6 +992,15 @@ static void shutdown_connection(Manager *m, DBusConnection *c) {
                 set_free(s);
         }
 
+        if (m->queued_message_connection == c) {
+                m->queued_message_connection = NULL;
+
+                if (m->queued_message) {
+                        dbus_message_unref(m->queued_message);
+                        m->queued_message = NULL;
+                }
+        }
+
         dbus_connection_set_dispatch_status_function(c, NULL, NULL, NULL);
         dbus_connection_flush(c);
         dbus_connection_close(c);
index b9971818da19199a3fcaf38213fc3702184f27ff..5b3aaf3364fe95d8be0a9d926253f125653d2fc1 100644 (file)
@@ -160,6 +160,7 @@ struct Manager {
                                       * before the reload we queue the
                                       * reply message here, and
                                       * afterwards we send it */
+        DBusConnection *queued_message_connection; /* The connection to send the queued message on */
 
         Hashmap *watch_bus;  /* D-Bus names => Unit object n:1 */
         int32_t name_data_slot;