server: Fix --autoplay-delay.
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 1 Jun 2016 16:59:09 +0000 (18:59 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 1 Jun 2016 16:59:09 +0000 (18:59 +0200)
init_vss_task() is called before the scheduler has initialized the
timeval available everywhere through the global now pointer. Hence,
in this function ->now is {0, 0}, and the computed autoplay barrier
will be in the past, effectively making --autoplay-delay a no-op.

Fix this by calling clock_get_realtime() to get the current time.

vss.c

diff --git a/vss.c b/vss.c
index 51db768..2acff1c 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -1187,7 +1187,7 @@ void init_vss_task(int afs_socket, struct sched *s)
                mmd->vss_status_flags |= VSS_PLAYING;
                mmd->new_vss_status_flags |= VSS_PLAYING;
                ms2tv(autoplay_delay, &tmp);
-               tv_add(now, &tmp, &vsst->autoplay_barrier);
+               tv_add(clock_get_realtime(NULL), &tmp, &vsst->autoplay_barrier);
                tv_add(&vsst->autoplay_barrier, &vsst->announce_tv,
                        &vsst->data_send_barrier);
        }