X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=audiod.c;h=85aa517ac536ae6796c84f5605556364af299234;hp=dbc1e850c2f615e3775d06fe62441274ff470bd3;hb=99054bc0013b3592b311027662bbacb6df49a4e2;hpb=566fce2b157e3cd134b35afc243472955423ea2c diff --git a/audiod.c b/audiod.c index dbc1e850..85aa517a 100644 --- a/audiod.c +++ b/audiod.c @@ -636,7 +636,7 @@ static void audiod_pre_select(struct sched *s, __a_unused struct task *t) s->timeout = min_delay; continue; } - PARA_INFO_LOG("inital delay: %lu ms left\n", tv2ms(&diff)); + PARA_INFO_LOG("initial delay: %lu ms left\n", tv2ms(&diff)); if (tv_diff(&s->timeout, &diff, NULL) > 0) { s->timeout = diff; } @@ -1011,11 +1011,16 @@ void __noreturn clean_exit(int status, const char *msg) exit(status); } +/* avoid busy loop if server is down */ +static void set_stat_task_restart_barrier(void) +{ + struct timeval delay = {5, 0}; + tv_add(now, &delay, &stat_task->restart_barrier); +} static void client_task_event_handler(__a_unused struct task *t) { int i; - struct timeval delay = {1, 0}; if (t->ret == -E_HANDSHAKE_COMPLETE) return; @@ -1023,8 +1028,7 @@ static void client_task_event_handler(__a_unused struct task *t) close_stat_pipe(); if (t->ret != -E_SERVER_EOF) stat_task->clock_diff_count = conf.clock_diff_count_arg; - /* avoid busy loop if server is down */ - tv_add(now, &delay, &stat_task->restart_barrier); + set_stat_task_restart_barrier(); FOR_EACH_AUDIO_FORMAT(i) afi[i].restart_barrier = stat_task->restart_barrier; } @@ -1053,6 +1057,7 @@ static void status_pre_select(struct sched *s, struct task *t) int argc = 2; ret = client_open(argc, argv, &st->pcd); } + set_stat_task_restart_barrier(); if (ret < 0) return; st->pcd->task.event_handler = client_task_event_handler;