]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - server.c
Consolidate receiver/filter/writer {pre,post}_select() docs.
[paraslash.git] / server.c
index 1020e4fed98ac03d0981d80d517e68abf6e3a76f..91fb9dff47dbefa6ca0207852a861bbb8d7f1a5e 100644 (file)
--- a/server.c
+++ b/server.c
@@ -24,8 +24,8 @@
 #include "net.h"
 #include "server.h"
 #include "list.h"
-#include "send.h"
 #include "sched.h"
+#include "send.h"
 #include "vss.h"
 #include "config.h"
 #include "close_on_fork.h"
@@ -257,7 +257,7 @@ static int signal_post_select(struct sched *s, __a_unused void *context)
        ret = task_get_notification(signal_task->task);
        if (ret < 0)
                return ret;
-       signum = para_next_signal(&s->rfds);
+       signum = para_next_signal();
        switch (signum) {
        case 0:
                return 0;
@@ -326,7 +326,7 @@ static void command_pre_select(struct sched *s, void *context)
        struct server_command_task *sct = context;
 
        for (n = 0; n < sct->num_listen_fds; n++)
-               para_fd_set(sct->listen_fds[n], &s->rfds, &s->max_fileno);
+               sched_monitor_readfd(sct->listen_fds[n], s);
 }
 
 static int command_task_accept(unsigned listen_idx, struct sched *s,
@@ -337,7 +337,7 @@ static int command_task_accept(unsigned listen_idx, struct sched *s,
        pid_t child_pid;
        uint32_t *chunk_table;
 
-       ret = para_accept(sct->listen_fds[listen_idx], &s->rfds, NULL, 0, &new_fd);
+       ret = para_accept(sct->listen_fds[listen_idx], NULL, 0, &new_fd);
        if (ret <= 0)
                goto out;
        mmd->num_connects++;
@@ -618,13 +618,13 @@ out:
 }
 
 static int server_select(int max_fileno, fd_set *readfds, fd_set *writefds,
-               struct timeval *timeout_tv)
+               int timeout)
 {
        int ret;
 
        status_refresh();
        mutex_unlock(mmd_mutex);
-       ret = para_select(max_fileno + 1, readfds, writefds, timeout_tv);
+       ret = para_select(max_fileno + 1, readfds, writefds, timeout);
        mutex_lock(mmd_mutex);
        return ret;
 }
@@ -658,7 +658,7 @@ int main(int argc, char *argv[])
        struct server_command_task server_command_task_struct,
                *sct = &server_command_task_struct;
 
-       sched.default_timeout.tv_sec = 1;
+       sched.default_timeout = 1000;
        sched.select_function = server_select;
 
        server_init(argc, argv, sct);
@@ -679,12 +679,13 @@ int main(int argc, char *argv[])
                deplete_close_on_fork_list();
                if (ret < 0)
                        PARA_EMERG_LOG("%s\n", para_strerror(-ret));
+               vss_shutdown();
        } else {
+               vss_shutdown();
                alarm(ALARM_TIMEOUT);
                close_listed_fds();
                ret = handle_connect(sct->child_fd);
        }
-       vss_shutdown();
        shm_detach(mmd);
        user_list_deplete();
        free_lpr();