X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=server.c;h=009c82a4b9e456a24e7896a663a84604d0cddf31;hb=21de9be569dc72dbc3feb3cea60b77b7e641a2c2;hp=99482d9d17f36ab0cfdd1e86e29ca1a641e6cf28;hpb=9163a0f2c295ef0b16ed09c46dffaec75478bb6a;p=paraslash.git diff --git a/server.c b/server.c index 99482d9d..009c82a4 100644 --- a/server.c +++ b/server.c @@ -110,32 +110,6 @@ struct server_args_info conf; /** the file containing user information (public key, permissions) */ char *user_list_file = NULL; -extern void dccp_send_init(struct sender *); -extern void http_send_init(struct sender *); -extern void ortp_send_init(struct sender *); - -/** the list of supported senders */ -struct sender senders[] = { - { - .name = "http", - .init = http_send_init, - }, - { - .name = "dccp", - .init = dccp_send_init, - }, -#ifdef HAVE_ORTP - { - .name = "ortp", - .init = ortp_send_init, - }, -#endif - { - .name = NULL, - } -}; - - /* global variables for server-internal use */ static FILE *logfile; static int mmd_mutex, mmd_shm_id; @@ -202,7 +176,6 @@ static void shm_init(void) mmd->active_connections = 0; mmd->vss_status_flags = VSS_NEXT; mmd->new_vss_status_flags = VSS_NEXT; - mmd->sender_cmd_data.cmd_num = -1; return; err_out: PARA_EMERG_LOG("%s\n", para_strerror(-ret)); @@ -454,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 * @@ -483,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; @@ -523,14 +502,6 @@ genocide: exit(EXIT_FAILURE); } } - if (mmd->sender_cmd_data.cmd_num >= 0) { - int num = mmd->sender_cmd_data.cmd_num, - s = mmd->sender_cmd_data.sender_num; - - if (senders[s].client_cmds[num]) - senders[s].client_cmds[num](&mmd->sender_cmd_data); - mmd->sender_cmd_data.cmd_num = -1; - } if (!FD_ISSET(sockfd, &rfds)) goto repeat;