From: Andre Noll Date: Sun, 31 Mar 2013 17:42:17 +0000 (+0000) Subject: server command task: Switch to the alternative post select method. X-Git-Tag: v0.4.13~39^2~14 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=a6dabdc1cd561d1ff38243c9457db47dce60d488;p=paraslash.git server command task: Switch to the alternative post select method. --- diff --git a/server.c b/server.c index 57f0c26e..07440003 100644 --- 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);