]> err.no Git - systemd/commitdiff
socket: when the socket is supposed to stop, don't accept any connections anymore
authorLennart Poettering <lennart@poettering.net>
Mon, 12 Jul 2010 22:27:27 +0000 (00:27 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 12 Jul 2010 22:27:27 +0000 (00:27 +0200)
src/automount.c
src/path.c
src/socket.c
src/timer.c

index 00f3736b2fc148c9eb5bf0bb223eca8073177dd3..e685c96a76ab7206b9407484d9a92bc89c652169 100644 (file)
@@ -568,6 +568,13 @@ static void automount_enter_runnning(Automount *a) {
 
         dbus_error_init(&error);
 
+        /* We don't take mount requests anymore if we are supposed to
+         * shut down anyway */
+        if (a->meta.job && a->meta.job->type == JOB_STOP) {
+                automount_send_ready(a, -EHOSTDOWN);
+                return;
+        }
+
         mkdir_p(a->where, a->directory_mode);
 
         /* Before we do anything, let's see if somebody is playing games with us? */
index 27c45447297882b3c44d522567fc1d7bfb915a90..2ae6e569ce93b88c0c250d39325c045bfd3c79a1 100644 (file)
@@ -304,6 +304,10 @@ static void path_enter_running(Path *p) {
         assert(p);
         dbus_error_init(&error);
 
+        /* Don't start job if we are supposed to go down */
+        if (p->meta.job && p->meta.job->type == JOB_STOP)
+                return;
+
         if ((r = manager_add_job(p->meta.manager, JOB_START, p->unit, JOB_REPLACE, true, &error, NULL)) < 0)
                 goto fail;
 
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;
index 1c7010d120829ddada9accf9c5bb217228e8ec42..0d4ed27bb4f325274cb532db75eb300ab94b983d 100644 (file)
@@ -268,6 +268,10 @@ static void timer_enter_running(Timer *t) {
         assert(t);
         dbus_error_init(&error);
 
+        /* Don't start job if we are supposed to go down */
+        if (t->meta.job && t->meta.job->type == JOB_STOP)
+                return;
+
         if ((r = manager_add_job(t->meta.manager, JOB_START, t->unit, JOB_REPLACE, true, &error, NULL)) < 0)
                 goto fail;