para_write: Fix --initial-delay.
authorAndre Noll <maan@systemlinux.org>
Tue, 25 Nov 2008 20:34:57 +0000 (21:34 +0100)
committerAndre Noll <maan@systemlinux.org>
Tue, 25 Nov 2008 20:34:57 +0000 (21:34 +0100)
write.c

diff --git a/write.c b/write.c
index 78e48dc..50ed221 100644 (file)
--- a/write.c
+++ b/write.c
@@ -106,14 +106,19 @@ static void initial_delay_pre_select(struct sched *s, struct task *t)
 
        if (!idt->start_time.tv_sec && !idt->start_time.tv_usec) {
                t->error = -E_NO_DELAY;
-               return;
+               goto register_check_wav;
        }
        if (tv_diff(now, &idt->start_time, &diff) > 0) {
                t->error = -E_DELAY_TIMEOUT;
-               return;
+               goto register_check_wav;
        }
        if (tv_diff(&s->timeout , &diff, NULL) > 0)
                s->timeout = diff;
+       return;
+register_check_wav:
+       register_task(&the_check_wav_task.task);
+       s->timeout.tv_sec = 0;
+       s->timeout.tv_usec = 1;
 }
 
 INIT_STDERR_LOGGING(conf.loglevel_arg)
@@ -210,7 +215,6 @@ int main(int argc, char *argv[])
        cwt->input_error = &sit.task.error;
        sprintf(cwt->task.status, "check wav");
        cwt->task.pre_select = check_wav_pre_select;
-       register_task(&cwt->task);
 
        idt->task.pre_select = initial_delay_pre_select;
        sprintf(idt->task.status, "initial_delay");