From 4a0a124cb7c207fe03bdc029261d200ab5b81268 Mon Sep 17 00:00:00 2001 From: Andre Date: Tue, 11 Jul 2006 14:50:36 +0200 Subject: [PATCH] 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). --- command.c | 4 +++- error.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) 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 \ -- 2.30.2