Fix inetd regression introduced in 10b72f1

This patch allows all services to go from READY -> RUNNING, this to
prevent started inetd connections from being treated as "stubborn"
and inadvertently killing them off after a few seconds.

The same actually applies to run/task applications.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2016-12-07 21:51:54 +01:00
1 parent 662dfbe777
commit 02e69932ae
1 file changed
+19 -27
+19 -27
View File
@@ -890,23 +890,7 @@ restart:
} }
svc_mark_clean(svc); svc_mark_clean(svc);
svc_set_state(svc, SVC_RUNNING_STATE);
switch (svc->type) {
case SVC_TYPE_INETD:
case SVC_TYPE_SERVICE:
svc_set_state(svc, SVC_RUNNING_STATE);
break;
case SVC_TYPE_INETD_CONN:
case SVC_TYPE_TASK:
case SVC_TYPE_RUN:
svc_set_state(svc, SVC_STOPPING_STATE);
break;
default:
_e("unknown service type %d", svc->type);
break;
}
} }
break; break;
@@ -917,17 +901,25 @@ restart:
break; break;
} }
if (!svc->pid && !svc_is_inetd(svc)) { if (!svc->pid) {
svc_restarting(svc); if (svc_is_daemon(svc)) {
svc_set_state(svc, SVC_HALTED_STATE); svc_restarting(svc);
svc_set_state(svc, SVC_HALTED_STATE);
/* /*
* Restart directly after the first crash, * Restart directly after the first crash,
* then retry after 2 sec * then retry after 2 sec
*/ */
_d("delayed restart of %s", svc->desc); _d("delayed restart of %s", svc->desc);
service_timeout_after(svc, 1, service_retry); service_timeout_after(svc, 1, service_retry);
break; break;
}
/* Collected inetd connection, drive it to stopping */
if (svc_is_inetd_conn(svc)) {
svc_set_state(svc, SVC_STOPPING_STATE);
break;
}
} }
cond = cond_get_agg(svc->cond); cond = cond_get_agg(svc->cond);