summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-13 00:51:48 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-13 00:52:17 +0200
commit7c610628cd907b8d04dbfe28dd23a0fa958c7dcd (patch)
treeb8e16c8469054cee6280450da7e8f393cd2025bb /src
parent201e673c487bc321024a118936f3ded0893dc725 (diff)
socket: when going down, flush all queued sockets
Diffstat (limited to 'src')
-rw-r--r--src/socket.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/socket.c b/src/socket.c
index f998cada26..4a9c939936 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;
}