From: Andre Date: Tue, 11 Jul 2006 12:50:36 +0000 (+0200) Subject: com_stat: abort on server crashes X-Git-Tag: v0.2.14~57^2~14 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=4a0a124cb7c207fe03bdc029261d200ab5b81268;ds=sidebyside com_stat: abort on server crashes Currently, if para_server gets killed by SIGKILL, its status clients happily move on and announce the most current stream. This causes audiod to restart the receivers in an endless loop. It's better to close the connection from within com_stat() if the parent pid equals one (which indicates that para_server has crashed). --- diff --git a/command.c b/command.c index 52d56c9e..55070a3d 100644 --- a/command.c +++ b/command.c @@ -690,7 +690,9 @@ static int com_stat(int socket_fd, int argc, char **argv) ret = 1; if (num == 1) goto out; - usleep(500000 * 100); + sleep(50); + if (getppid() == 1) + return -E_SERVER_CRASH; } out: return ret; diff --git a/error.h b/error.h index 78e3242c..706dea9e 100644 --- a/error.h +++ b/error.h @@ -348,6 +348,7 @@ extern const char **para_errlist[]; PARA_ERROR(BAD_USER, "you don't exist. Go away."), \ PARA_ERROR(LOCK, "lock error"), \ PARA_ERROR(SENDER_CMD, "command not supported by this sender"), \ + PARA_ERROR(SERVER_CRASH, "para_server crashed -- can not live without it"), \ #define PLAYLIST_SELECTOR_ERRORS \