chiark / gitweb /
manager: add DefaultEnvironment option
[elogind.git] / src / core / dbus.c
index 62cbf89f647d41667528d55ae85b3bac0815de58..1272c938cf55fffbdf0c4bcccfb2a379bc79d44a 100644 (file)
@@ -48,7 +48,7 @@
 #include "special.h"
 #include "dbus-common.h"
 
-#define CONNECTIONS_MAX 52
+#define CONNECTIONS_MAX 512
 
 /* Well-known address (http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-types) */
 #define DBUS_SYSTEM_BUS_DEFAULT_ADDRESS "unix:path=/var/run/dbus/system_bus_socket"
@@ -203,13 +203,11 @@ static void bus_toggle_watch(DBusWatch *bus_watch, void *data) {
 }
 
 static int bus_timeout_arm(Manager *m, Watch *w) {
-        struct itimerspec its;
+        struct itimerspec its = {};
 
         assert(m);
         assert(w);
 
-        zero(its);
-
         if (dbus_timeout_get_enabled(w->data.bus_timeout)) {
                 timespec_store(&its.it_value, dbus_timeout_get_interval(w->data.bus_timeout) * USEC_PER_MSEC);
                 its.it_interval = its.it_value;
@@ -365,8 +363,8 @@ static DBusHandlerResult api_bus_message_filter(DBusConnection *connection, DBus
 
                         log_debug("Got D-Bus activation request for %s", name);
 
-                        if (manager_unit_pending_inactive(m, SPECIAL_DBUS_SERVICE) ||
-                            manager_unit_pending_inactive(m, SPECIAL_DBUS_SOCKET)) {
+                        if (manager_unit_inactive_or_pending(m, SPECIAL_DBUS_SERVICE) ||
+                            manager_unit_inactive_or_pending(m, SPECIAL_DBUS_SOCKET)) {
                                 r = -EADDRNOTAVAIL;
                                 dbus_set_error(&error, BUS_ERROR_SHUTTING_DOWN, "Refusing activation, D-Bus is shutting down.");
                         } else {
@@ -978,9 +976,8 @@ static DBusConnection* manager_bus_connect_private(Manager *m, DBusBusType type)
         }
 
         return connection;
+
 fail:
-        if (connection)
-                dbus_connection_close(connection);
         dbus_error_free(&error);
         return NULL;
 }