]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - audiod.c
audiod: Increase default select timeout to 1s.
[paraslash.git] / audiod.c
index 29a8aa30abec6be72aee946b92d7767f3fc037e5..27c153d791ee95983591e89176cf5917545e41df 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -5,6 +5,7 @@
  */
 
 /** \file audiod.c the paraslash's audio daemon */
+#include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <signal.h>
@@ -901,8 +902,15 @@ static void command_post_select(struct sched *s, struct task *t)
 {
        int ret;
        struct command_task *ct = container_of(t, struct command_task, task);
+       static struct timeval last_status_dump;
+       struct timeval tmp;
+
+       tv_add(&last_status_dump, &(struct timeval){0, 500 * 1000}, &tmp);
+       if (tv_diff(&tmp, now, NULL) < 0) {
+               audiod_status_dump();
+               last_status_dump = *now;
+       }
 
-       audiod_status_dump();
        if (!FD_ISSET(ct->fd, &s->rfds))
                return;
        ret = handle_connect(ct->fd);
@@ -1226,7 +1234,7 @@ int main(int argc, char *argv[])
        register_task(&cmd_task->task);
        register_task(&stat_task->task);
        s.default_timeout.tv_sec = 0;
-       s.default_timeout.tv_usec = 99 * 1000;
+       s.default_timeout.tv_usec = 999 * 1000;
        ret = schedule(&s);
 
        PARA_EMERG_LOG("%s\n", para_strerror(-ret));