chiark / gitweb /
socket: when the socket is supposed to stop, don't accept any connections anymore
[elogind.git] / src / socket.c
index 2d113aef306d8ef31c2f5ce3689cd14c1e391706..f998cada26b0e4c3f4cfd50d54cffd8ac64edaa3 100644 (file)
@@ -1030,6 +1030,13 @@ static void socket_enter_running(Socket *s, int cfd) {
         assert(s);
         dbus_error_init(&error);
 
+        /* We don't take connections anymore if we are supposed to
+         * shut down anyway */
+        if (s->meta.job && s->meta.job->type == JOB_STOP) {
+                close_nointr_nofail(cfd);
+                return;
+        }
+
         if (cfd < 0) {
                 if ((r = manager_add_job(s->meta.manager, JOB_START, UNIT(s->service), JOB_REPLACE, true, &error, NULL)) < 0)
                         goto fail;