From 1df6a91a94ed4dc9b2640b0ac5842bd4b326f14e Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Tue, 23 Jan 2018 00:44:40 +0100 Subject: [PATCH] Document sufficiently complex, yet deceptively simple, function Signed-off-by: Joachim Nilsson --- src/service.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/service.c b/src/service.c index dd5a17ca..b299946f 100644 --- a/src/service.c +++ b/src/service.c @@ -847,6 +847,17 @@ recreate: return 0; } +/* + * This function is called when cleaning up lingering (stopped) services + * after a .conf reload, as well as when an inetd connection terminates. + * + * We need to ensure we properly stop the service before removing it, + * including stopping any pending restart or SIGKILL timers before we + * proceed to free() the svc itself. + * + * Remember to not try to stop inetd connections, they only get here + * when already stopped, if we do we end up in a recursive loop. + */ void service_unregister(svc_t *svc) { if (!svc)