diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-07-10 04:52:00 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-07-10 04:52:00 +0200 |
commit | 3f6c78dcebdc0904d3b614da07e9ec8d84de2532 (patch) | |
tree | 71dd11b3f29bb6341270fec2e0afe0fdf8dc96be /src/socket.c | |
parent | 82c64bf578623f0678b4de1ac08c6bd8e5d95662 (diff) | |
download | systemd-3f6c78dcebdc0904d3b614da07e9ec8d84de2532.tar.gz |
service: allow immediate stopping while starting
Diffstat (limited to 'src/socket.c')
-rw-r--r-- | src/socket.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/socket.c b/src/socket.c index 6cbb14137e..7ff2927aff 100644 --- a/src/socket.c +++ b/src/socket.c @@ -1166,21 +1166,23 @@ static int socket_stop(Unit *u) { assert(s); - /* We cannot fulfill this request right now, try again later - * please! */ - if (s->state == SOCKET_START_PRE || - s->state == SOCKET_START_POST) - return -EAGAIN; - /* Already on it */ if (s->state == SOCKET_STOP_PRE || s->state == SOCKET_STOP_PRE_SIGTERM || s->state == SOCKET_STOP_PRE_SIGKILL || s->state == SOCKET_STOP_POST || s->state == SOCKET_FINAL_SIGTERM || - s->state == SOCKET_FINAL_SIGTERM) + s->state == SOCKET_FINAL_SIGKILL) return 0; + /* If there's already something running we go directly into + * kill mode. */ + if (s->state == SOCKET_START_PRE || + s->state == SOCKET_START_POST) { + socket_enter_signal(s, SOCKET_STOP_PRE_SIGTERM, true); + return -EAGAIN; + } + assert(s->state == SOCKET_LISTENING || s->state == SOCKET_RUNNING); socket_enter_stop_pre(s, true); |