mirror of
https://github.com/troglobit/finit.git
synced 2026-10-08 16:34:45 +07:00
Fix #280: allow calling initctl restart foo from within foo
Move the stop+start from initctl to the state machine by allowing stopped tasks to restart once it has been collected. This should prevent finit from blocking, allowing it to handle other requests while waiting for the service's PID to be collected. Effectively, this will allow a service to call initctl to restart itself, as reported in issue #280. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -89,8 +89,7 @@ static int restart(svc_t *svc, void *user_data)
|
||||
if (!svc)
|
||||
return 1;
|
||||
|
||||
svc_mark_dirty(svc);
|
||||
svc_start(svc);
|
||||
service_stop(svc);
|
||||
service_step(svc);
|
||||
|
||||
return 0;
|
||||
@@ -319,6 +318,10 @@ static void api_cb(uev_t *w, void *arg, int events)
|
||||
if (EAGAIN == errno)
|
||||
break;
|
||||
|
||||
/* we get here when client restarts itself */
|
||||
if (ECONNRESET == errno)
|
||||
break;
|
||||
|
||||
_e("Failed reading initctl request, error %d: %s", errno, strerror(errno));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user