]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - audiod.c
audiod: Improve status timeout handling.
[paraslash.git] / audiod.c
index 6afb15ef74effcc3ffb31be401e7340d2252635a..dcf2c14738d3336bcce19dbc9a2fcd565dcded7a 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -1007,7 +1007,7 @@ static int signal_post_select(struct sched *s, __a_unused struct task *t)
        case SIGINT:
        case SIGTERM:
        case SIGHUP:
-               PARA_EMERG_LOG("terminating on signal %d\n", signum);
+               PARA_NOTICE_LOG("received signal %d\n", signum);
                clean_exit(EXIT_FAILURE, "caught deadly signal");
        }
        return 0;
@@ -1136,7 +1136,6 @@ void __noreturn clean_exit(int status, const char *msg)
 {
        int i;
 
-       PARA_EMERG_LOG("%s\n", msg);
        if (socket_name)
                unlink(socket_name);
        close_stat_pipe();
@@ -1144,6 +1143,7 @@ void __noreturn clean_exit(int status, const char *msg)
                close_slot(i);
        audiod_cmdline_parser_free(&conf);
        close_stat_clients();
+       PARA_EMERG_LOG("%s\n", msg);
        exit(status);
 }
 
@@ -1228,14 +1228,15 @@ static int status_post_select(struct sched *s, struct task *t)
                char *buf;
                size_t sz;
                int ret;
-               if (st->ct->task.error < 0) {
+
+               ret = btr_node_status(st->btrn, st->min_iqs, BTR_NT_LEAF);
+               if (ret < 0) {
                        close_stat_pipe();
                        goto out;
                }
                if (st->ct->status != CL_EXECUTING)
                        goto out;
-               ret = btr_node_status(st->btrn, st->min_iqs, BTR_NT_LEAF);
-               if (ret <= 0) {
+               if (ret == 0) {
                        struct timeval diff;
                        tv_diff(now, &st->last_status_read, &diff);
                        if (diff.tv_sec > 61)