tv_add(now, &delay, &stat_task->restart_barrier);
}
-#if 0
-static void client_task_event_handler(__a_unused struct task *t)
-{
- int i;
-
- if (t->ret == -E_HANDSHAKE_COMPLETE)
- return;
- unregister_task(t);
- close_stat_pipe();
- if (t->ret != -E_SERVER_EOF)
- stat_task->clock_diff_count = conf.clock_diff_count_arg;
- set_stat_task_restart_barrier();
- FOR_EACH_AUDIO_FORMAT(i)
- afi[i].restart_barrier = stat_task->restart_barrier;
-}
-#endif
-
+/* restart the client task if necessary */
static void status_pre_select(struct sched *s, struct task *t)
{
struct status_task *st = container_of(t, struct status_task, task);
int ret;
- if (st->ct || audiod_status == AUDIOD_OFF)
+ if (st->ct || audiod_status == AUDIOD_OFF) /* no need to restart */
return;
if (!st->clock_diff_count && tv_diff(now, &st->restart_barrier, NULL)
< 0)
return;
- if (st->clock_diff_count) {
+ if (st->clock_diff_count) { /* get status only one time */
char *argv[] = {"audiod", "stat", "1", NULL};
int argc = 3;
if (tv_diff(now, &st->clock_diff_barrier, NULL) < 0)
if (!st->ct || st->ct->status != CL_RECEIVING)
return;
- if (st->ct && audiod_status == AUDIOD_OFF) {
- unregister_task(&st->ct->task);
+ if (audiod_status == AUDIOD_OFF || st->ct->task.error < 0) {
+ if (st->ct->task.error >= 0)
+ unregister_task(&st->ct->task);
+ if (audiod_status == AUDIOD_OFF)
+ st->clock_diff_count = conf.clock_diff_count_arg;
close_stat_pipe();
- st->clock_diff_count = conf.clock_diff_count_arg;
return;
}
bytes_left = for_each_line(st->ct->buf, st->ct->loaded,