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")) {
* 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))) {
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);
* 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;