server command task: Switch to the alternative post select method.
authorAndre Noll <maan@systemlinux.org>
Sun, 31 Mar 2013 17:42:17 +0000 (17:42 +0000)
committerAndre Noll <maan@systemlinux.org>
Tue, 30 Apr 2013 12:12:46 +0000 (14:12 +0200)
server.c

index 57f0c26..0744000 100644 (file)
--- a/server.c
+++ b/server.c
@@ -357,7 +357,7 @@ static void command_pre_select(struct sched *s, struct task *t)
        para_fd_set(sct->listen_fd, &s->rfds, &s->max_fileno);
 }
 
-static void command_post_select(struct sched *s, struct task *t)
+static int command_post_select(struct sched *s, struct task *t)
 {
        struct server_command_task *sct = container_of(t, struct server_command_task, task);
 
@@ -391,7 +391,7 @@ static void command_post_select(struct sched *s, struct task *t)
        if (child_pid) {
                close(new_fd);
                /* parent keeps accepting connections */
-               return;
+               return 0;
        }
        /* mmd might already have changed at this point */
        free(chunk_table);
@@ -405,10 +405,12 @@ static void command_post_select(struct sched *s, struct task *t)
        for (i = sct->argc - 1; i >= 0; i--)
                memset(sct->argv[i], 0, strlen(sct->argv[i]));
        sprintf(sct->argv[0], "para_server (serving %s)", peer_name);
-       return handle_connect(new_fd, peer_name);
+       handle_connect(new_fd, peer_name);
+       /* never reached*/
 out:
        if (ret < 0)
                PARA_CRIT_LOG("%s\n", para_strerror(-ret));
+       return 0;
 }
 
 static void init_server_command_task(int argc, char **argv)
@@ -419,7 +421,8 @@ static void init_server_command_task(int argc, char **argv)
 
        PARA_NOTICE_LOG("initializing tcp command socket\n");
        sct->task.pre_select = command_pre_select;
-       sct->task.post_select = command_post_select;
+       sct->task.new_post_select = command_post_select;
+       sct->task.post_select = NULL;
        sct->argc = argc;
        sct->argv = argv;
        ret = para_listen_simple(IPPROTO_TCP, conf.port_arg);