server.c: Introduce server_select().
authorAndre Noll <maan@systemlinux.org>
Sat, 12 Apr 2008 10:00:22 +0000 (12:00 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 12 Apr 2008 10:00:22 +0000 (12:00 +0200)
server.c

index 190df8a..009c82a 100644 (file)
--- a/server.c
+++ b/server.c
@@ -427,6 +427,18 @@ out:
        }
 }
 
+static int server_select(int max_fileno, fd_set *readfds, fd_set *writefds,
+               struct timeval *timeout_tv)
+{
+       int ret;
+
+       status_refresh();
+       mmd_unlock();
+       ret = para_select(max_fileno + 1, readfds, writefds, timeout_tv);
+       mmd_lock();
+       return ret;
+}
+
 /**
  * the main function of para_server
  *
@@ -456,14 +468,8 @@ repeat:
        para_fd_set(sockfd, &rfds, &max_fileno);
        para_fd_set(signal_pipe, &rfds, &max_fileno);
        timeout = vss_preselect(&rfds, &wfds, &max_fileno);
-       status_refresh();
-       mmd_unlock();
-       ret = para_select(max_fileno + 1, &rfds, &wfds, timeout);
-       mmd_lock();
-       if (ret < 0)
-               goto repeat;
+       server_select(max_fileno + 1, &rfds, &wfds, timeout);
        vss_post_select(&rfds, &wfds);
-       status_refresh();
        if (FD_ISSET(signal_pipe, &rfds)) {
                int sig;
                pid_t pid;