vol: Add timeouts to SYNC server select() calls
[openafs.git] / src / vol / salvsync-server.c
index f6b530a..f054dd6 100644 (file)
@@ -342,11 +342,14 @@ SALVSYNC_syncThread(void * args)
 
     for (;;) {
        int maxfd;
+       struct timeval s_timeout;
        GetHandler(&SALVSYNC_readfds, &maxfd);
+       s_timeout.tv_sec = SYNC_SELECT_TIMEOUT;
+       s_timeout.tv_usec = 0;
        /* Note: check for >= 1 below is essential since IOMGR_select
         * doesn't have exactly same semantics as select.
         */
-       if (select(maxfd + 1, &SALVSYNC_readfds, NULL, NULL, NULL) >= 1)
+       if (select(maxfd + 1, &SALVSYNC_readfds, NULL, NULL, &s_timeout) >= 1)
            CallHandler(&SALVSYNC_readfds);
     }