summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-29 19:02:08 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-29 19:02:08 +0200
commit8f88ecf6232fe6c46eecafad7c421096bb29b617 (patch)
treeca4bdc49aaf4249e7cdf2e8b866a4e0d2d21d498
parent9030ca462bd13cd6536299814e4a71d5c5e85be9 (diff)
core: for queued reload message there is no need to store the bus explicitly
After all it can be derived from the message directly, and already is.
-rw-r--r--src/core/dbus-manager.c1
-rw-r--r--src/core/dbus.c13
-rw-r--r--src/core/manager.h8
3 files changed, 6 insertions, 16 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 632529fcbc..18a379f8c4 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -1166,7 +1166,6 @@ static int method_reload(sd_bus_message *message, void *userdata, sd_bus_error *
if (r < 0)
return r;
- m->queued_message_bus = sd_bus_ref(sd_bus_message_get_bus(message));
m->exit_code = MANAGER_RELOAD;
return 1;
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 8d72502a1a..d1843aa290 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -55,18 +55,15 @@ int bus_send_queued_message(Manager *m) {
if (!m->queued_message)
return 0;
- assert(m->queued_message_bus);
-
/* If we cannot get rid of this message we won't dispatch any
* D-Bus messages, so that we won't end up wanting to queue
* another message. */
- r = sd_bus_send(m->queued_message_bus, m->queued_message, NULL);
+ r = sd_bus_send(NULL, m->queued_message, NULL);
if (r < 0)
log_warning_errno(r, "Failed to send queued message: %m");
m->queued_message = sd_bus_message_unref(m->queued_message);
- m->queued_message_bus = sd_bus_unref(m->queued_message_bus);
return 0;
}
@@ -1031,12 +1028,8 @@ static void destroy_bus(Manager *m, sd_bus **bus) {
j->clients = sd_bus_track_unref(j->clients);
/* Get rid of queued message on this bus */
- if (m->queued_message_bus == *bus) {
- m->queued_message_bus = sd_bus_unref(m->queued_message_bus);
-
- if (m->queued_message)
- m->queued_message = sd_bus_message_unref(m->queued_message);
- }
+ if (m->queued_message && sd_bus_message_get_bus(m->queued_message) == *bus)
+ m->queued_message = sd_bus_message_unref(m->queued_message);
/* Possibly flush unwritten data, but only if we are
* unprivileged, since we don't want to sync here */
diff --git a/src/core/manager.h b/src/core/manager.h
index a1caab4d4e..a9834a9def 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -199,11 +199,9 @@ struct Manager {
sd_bus_track *subscribed;
char **deserialized_subscribed;
- sd_bus_message *queued_message; /* This is used during reloading:
- * before the reload we queue the
- * reply message here, and
- * afterwards we send it */
- sd_bus *queued_message_bus; /* The connection to send the queued message on */
+ /* This is used during reloading: before the reload we queue
+ * the reply message here, and afterwards we send it */
+ sd_bus_message *queued_message;
Hashmap *watch_bus; /* D-Bus names => Unit object n:1 */