chiark / gitweb /
core: rewind message before forwarding it
[elogind.git] / src / core / dbus.c
index e7cf93dc6c3eecb6fc0b666b7a24cbb3d8b50b58..e000cccd1110cd16d221179fb95c4c4adbaba54f 100644 (file)
@@ -20,7 +20,6 @@
 ***/
 
 #include <sys/epoll.h>
-#include <sys/timerfd.h>
 #include <errno.h>
 #include <unistd.h>
 
@@ -44,7 +43,7 @@
 #include "bus-internal.h"
 #include "selinux-access.h"
 
-#define CONNECTIONS_MAX 512
+#define CONNECTIONS_MAX 4096
 
 static void destroy_bus(Manager *m, sd_bus **bus);
 
@@ -89,15 +88,19 @@ static int signal_agent_released(sd_bus *bus, sd_bus_message *message, void *use
 
         manager_notify_cgroup_empty(m, cgroup);
 
-        if (m->running_as == SYSTEMD_SYSTEM && m->system_bus) {
-                /* If we are running as system manager, forward the
-                 * message to the system bus */
+        /* only forward to system bus if running as system instance */
+        if (m->running_as != SYSTEMD_SYSTEM || !m->system_bus)
+                return 0;
 
-                r = sd_bus_send(m->system_bus, message, NULL);
-                if (r < 0)
-                        log_warning_errno(r, "Failed to forward Released message: %m");
-        }
+        r = sd_bus_message_rewind(message, 1);
+        if (r < 0)
+                goto exit;
+
+        r = sd_bus_send(m->system_bus, message, NULL);
 
+exit:
+        if (r < 0)
+                log_warning_errno(r, "Failed to forward Released message: %m");
         return 0;
 }