Consider other modes of generator failure terminal and shut down
This commit is contained in:
parent
28f3f6cb2e
commit
7ab22aa1ec
@ -320,9 +320,9 @@ static void *watchdog(void *arg)
|
||||
|
||||
rename_proc("watchdog");
|
||||
while (42) {
|
||||
int pid, status;
|
||||
int pid;
|
||||
|
||||
pid = wait(&status);
|
||||
pid = waitpid(0, NULL, 0);
|
||||
if (pid == ckp->generator.pid) {
|
||||
LOGERR("Generator process dead! Relaunching");
|
||||
launch_process(&ckp->generator);
|
||||
@ -332,6 +332,9 @@ static void *watchdog(void *arg)
|
||||
} else if (pid == ckp->connector.pid) {
|
||||
LOGERR("Connector process dead! Relaunching");
|
||||
launch_process(&ckp->connector);
|
||||
} else {
|
||||
LOGEMERG("Unknown child process %d dead, exiting!", pid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
@ -104,14 +104,13 @@ int generator(proc_instance_t *pi)
|
||||
char *userpass = NULL;
|
||||
gbtbase_t gbt;
|
||||
connsock_t cs;
|
||||
int ret = 0;
|
||||
int ret = 1;
|
||||
|
||||
memset(&cs, 0, sizeof(cs));
|
||||
memset(&gbt, 0, sizeof(gbt));
|
||||
|
||||
if (!extract_sockaddr(ckp->btcdurl, &cs.url, &cs.port)) {
|
||||
LOGWARNING("Failed to extract address from %s", ckp->btcdurl);
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
userpass = strdup(ckp->btcdauth);
|
||||
@ -120,14 +119,12 @@ int generator(proc_instance_t *pi)
|
||||
cs.auth = http_base64(userpass);
|
||||
if (!cs.auth) {
|
||||
LOGWARNING("Failed to create base64 auth from %s", userpass);
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
dealloc(userpass);
|
||||
cs.fd = connect_socket(cs.url, cs.port);
|
||||
if (cs.fd < 0) {
|
||||
LOGWARNING("Failed to connect socket to %s:%s", cs.url, cs.port);
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
keep_sockalive(cs.fd);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user