[systemd-commits] src/socket.c

Lennart Poettering lennart at kemper.freedesktop.org
Mon Jul 12 15:52:36 PDT 2010


 src/socket.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 7c610628cd907b8d04dbfe28dd23a0fa958c7dcd
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jul 13 00:51:48 2010 +0200

    socket: when going down, flush all queued sockets

diff --git a/src/socket.c b/src/socket.c
index f998cad..4a9c939 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -1033,7 +1033,18 @@ static void socket_enter_running(Socket *s, int cfd) {
         /* 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);
+                if (cfd >= 0)
+                        close_nointr_nofail(cfd);
+                else  {
+                        /* Flush all sockets by closing and reopening them */
+                        socket_close_fds(s);
+
+                        if ((r = socket_watch_fds(s)) < 0) {
+                                log_warning("%s failed to watch sockets: %s", s->meta.id, strerror(-r));
+                                socket_enter_stop_pre(s, false);
+                        }
+                }
+
                 return;
         }
 


More information about the systemd-commits mailing list