From 31afa0a44c2d7f93d837c840cdbd623982ac165f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 25 Apr 2013 21:57:41 -0300 Subject: unit: rework stop pending logic When a trigger unit wants to know if a stop is queued for it, we should just check precisely that and do not check whether it is actually stopped already. This is because we use these checks usually from state change calls where the state variables are not updated yet. This change splits unit_pending_inactive() into two calls unit_inactive_or_pending() and unit_stop_pending(). The former checks state and pending jobs, the latter only pending jobs. --- src/core/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/socket.c') diff --git a/src/core/socket.c b/src/core/socket.c index 9f1af1e28f..c276afe38f 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1447,7 +1447,7 @@ static void socket_enter_running(Socket *s, int cfd) { /* We don't take connections anymore if we are supposed to * shut down anyway */ - if (unit_pending_inactive(UNIT(s))) { + if (unit_stop_pending(UNIT(s))) { log_debug_unit(UNIT(s)->id, "Suppressing connection request on %s since unit stop is scheduled.", UNIT(s)->id); @@ -1478,7 +1478,7 @@ static void socket_enter_running(Socket *s, int cfd) { /* If there's already a start pending don't bother to * do anything */ SET_FOREACH(u, UNIT(s)->dependencies[UNIT_TRIGGERS], i) - if (unit_pending_active(u)) { + if (unit_active_or_pending(u)) { pending = true; break; } -- cgit v1.2.3-54-g00ecf