chiark / gitweb /
bus: when a busname unit refuses to activate a service it should flush the queue
authorLennart Poettering <lennart@poettering.net>
Mon, 16 Dec 2013 20:26:21 +0000 (21:26 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 16 Dec 2013 20:26:21 +0000 (21:26 +0100)
src/core/busname.c
src/core/socket.c

index 49a43feb376f3b4afb2580e84f62bfb787168751..034e5f60d12373a5fd9dbbbc91f83088b5bdf490 100644 (file)
@@ -197,6 +197,8 @@ static void busname_unwatch_fd(BusName *n) {
 static void busname_close_fd(BusName *n) {
         assert(n);
 
+        busname_unwatch_fd(n);
+
         if (n->starter_fd <= 0)
                 return;
 
@@ -333,6 +335,11 @@ static void busname_enter_running(BusName *n) {
 
         if (unit_stop_pending(UNIT(n))) {
                 log_debug_unit(UNIT(n)->id, "Suppressing activation request on %s since unit stop is scheduled.", UNIT(n)->id);
+
+                /* Flush all queued activation reqeuest by closing and reopening the connection */
+
+                busname_close_fd(n);
+                busname_enter_listening(n);
                 return;
         }
 
index aaaa8d6499b94da2f8e864fcaeb936dc8a107ec5..d6289a31693b2cfeb4b0680d789f1dca7e43f3b9 100644 (file)
@@ -1475,6 +1475,13 @@ static void socket_enter_running(Socket *s, int cfd) {
                         /* Flush all sockets by closing and reopening them */
                         socket_close_fds(s);
 
+                        r = socket_open_fds(s);
+                        if (r < 0) {
+                                log_warning_unit(UNIT(s)->id, "%s failed to listen on sockets: %s", UNIT(s)->id, strerror(-r));
+                                socket_enter_stop_pre(s, SOCKET_FAILURE_RESOURCES);
+                                return;
+                        }
+
                         r = socket_watch_fds(s);
                         if (r < 0) {
                                 log_warning_unit(UNIT(s)->id, "%s failed to watch sockets: %s", UNIT(s)->id, strerror(-r));