Skip to content
Snippets Groups Projects
Commit 57deaa8d authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

do not start twice earlier service

parent e15e7a0b
No related branches found
No related tags found
No related merge requests found
......@@ -45,6 +45,9 @@ static void doit(stralloc *sa, ssexec_t *info, uint8_t earlier)
FLAGS_SET(flag, STATE_FLAGS_TOPROPAGATE|STATE_FLAGS_WANTUP) ;
if (earlier)
FLAGS_SET(flag, STATE_FLAGS_ISEARLIER) ;
/** build the graph of the entire system */
graph_build_service(&graph, ares, &areslen, info, flag) ;
......@@ -54,8 +57,14 @@ static void doit(stralloc *sa, ssexec_t *info, uint8_t earlier)
FOREACH_SASTR(sa, n) {
int aresid = service_resolve_array_search(ares, areslen, sa->s + n) ;
if (aresid < 0)
if (aresid < 0) {
if (earlier) {
log_warn("ignoring none earlier service: ", sa->s + n) ;
continue ;
}
log_die(LOG_EXIT_USER, "service: ", sa->s + n, " not available -- did you parse it?") ;
}
unsigned int l[graph.mlen], c = 0, pos = 0, idx = 0 ;
......
......@@ -466,7 +466,7 @@ static int ssexec_callback(stralloc *sa, ssexec_t *info, unsigned int what)
if (!state_read(&ste, &res))
log_dieu(LOG_EXIT_SYS, "read state file of: ", name, " -- please make a bug report") ;
if (service_is(&ste, !what ? STATE_FLAGS_ISENABLED : STATE_FLAGS_ISSUPERVISED) == STATE_FLAGS_TRUE) {
if (!what ? ste.isenabled : ste.issupervised == STATE_FLAGS_TRUE && ste.isearlier == STATE_FLAGS_FALSE) {
if (get_rstrlen_until(name, SS_LOG_SUFFIX) < 0 && !res.inmodule)
if (!sastr_add_string(sa, name))
......
......@@ -43,7 +43,7 @@ void sanitize_graph(ssexec_t *info)
resolve_service_t ares[SS_MAX_SERVICE + 1] ;
graph_t graph = GRAPH_ZERO ;
FLAGS_SET(flag, STATE_FLAGS_TOPROPAGATE|STATE_FLAGS_TOPARSE|STATE_FLAGS_WANTUP|STATE_FLAGS_WANTDOWN) ;
FLAGS_SET(flag, STATE_FLAGS_TOPROPAGATE|STATE_FLAGS_TOPARSE|STATE_FLAGS_WANTUP|STATE_FLAGS_WANTDOWN|STATE_FLAGS_ISEARLIER) ;
/** build the graph of the entire system */
graph_build_service(&graph, ares, &areslen, info, flag) ;
......
......@@ -86,12 +86,26 @@ void service_graph_collect(graph_t *g, char const *alist, size_t alen, resolve_s
if (resolve_read_g(wres, info->base.s, name) <= 0)
log_dieu(LOG_EXIT_SYS, "read resolve file of: ", name, " -- please make a bug report") ;
if (FLAGS_ISSET(flag, STATE_FLAGS_ISSUPERVISED)) {
if (!state_read(&ste, &res))
log_dieu(LOG_EXIT_SYS, "read state file of: ", name, " -- please make a bug report") ;
if (FLAGS_ISSET(flag, STATE_FLAGS_ISEARLIER)) {
if (!state_read(&ste, &res))
log_dieu(LOG_EXIT_SYS, "read state file of: ", name, " -- please make a bug report") ;
if (ste.isearlier == STATE_FLAGS_TRUE) {
if (!service_resolve_copy(&cp, &res))
log_dieu(LOG_EXIT_SYS, "copy resolve file of: ", name, " -- please make a bug report") ;
ares[(*areslen)++] = cp ;
continue ;
}
resolve_free(wres) ;
continue ;
}
if (FLAGS_ISSET(flag, STATE_FLAGS_ISSUPERVISED)) {
if (service_is(&ste, STATE_FLAGS_ISSUPERVISED) == STATE_FLAGS_TRUE) {
if (ste.issupervised == STATE_FLAGS_TRUE) {
if (!service_resolve_copy(&cp, &res))
log_dieu(LOG_EXIT_SYS, "copy resolve file of: ", name, " -- please make a bug report") ;
......
......@@ -167,6 +167,10 @@ int svc_compute_ns(resolve_service_t *res, uint8_t what, ssexec_t *info, char co
if (aresid < 0)
log_die(LOG_EXIT_USER, "service: ", name, " not available -- did you parse it?") ;
if (ares[aresid].earlier) {
log_warn("ignoring ealier service: ", ares[aresid].sa.s + ares[aresid].name) ;
continue ;
}
graph_compute_visit(name, visit, list, &graph, &napid, requiredby) ;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment