]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
com_stat: abort on server crashes
authorAndre <maan@p133.(none)>
Tue, 11 Jul 2006 12:50:36 +0000 (14:50 +0200)
committerAndre <maan@p133.(none)>
Tue, 11 Jul 2006 12:50:36 +0000 (14:50 +0200)
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
error.h

index 52d56c9eba015880000db26e4183814434ad6f39..55070a3d7a89950051a1374c400511527c19b7a9 100644 (file)
--- 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;
                ret = 1;
                if (num == 1)
                        goto out;
-               usleep(500000 * 100);
+               sleep(50);
+               if (getppid() == 1)
+                       return -E_SERVER_CRASH;
        }
 out:
        return ret;
        }
 out:
        return ret;
diff --git a/error.h b/error.h
index 78e3242cdd71b0d5484033d671b24088e735bf91..706dea9e526f468a187be4a75f2bba50226db23e 100644 (file)
--- 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(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 \
 
 
 #define PLAYLIST_SELECTOR_ERRORS \