]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - server.c
Move struct senders[] from server.c to vss.c.
[paraslash.git] / server.c
index 90dfc1f58962f69355775fd87e4c08f8253efeac..190df8a14ebf9613399bea5e55f0ae65f741645a 100644 (file)
--- 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));
@@ -257,8 +230,9 @@ static void parse_config(int override)
                struct server_cmdline_parser_params params = {
                        .override = override,
                        .initialize = 0,
-                       .check_required = 0,
-                       .check_ambiguity = 0
+                       .check_required = 1,
+                       .check_ambiguity = 0,
+                       .print_errors = 1
                };
                server_cmdline_parser_config_file(cf, &conf, &params);
                conf.daemon_given = tmp;
@@ -379,10 +353,16 @@ static unsigned server_init(int argc, char **argv)
 {
        /* connector's address information */
        int sockfd;
-
+       struct server_cmdline_parser_params params = {
+               .override = 0,
+               .initialize = 1,
+               .check_required = 0,
+               .check_ambiguity = 0,
+               .print_errors = 1
+       };
        init_random_seed();
        /* parse command line options */
-       server_cmdline_parser(argc, argv, &conf);
+       server_cmdline_parser_ext(argc, argv, &conf, &params);
        HANDLE_VERSION_FLAG("server", conf);
        para_drop_privileges(conf.user_arg, conf.group_arg);
        /* parse config file, open log and set defaults */
@@ -477,23 +457,12 @@ repeat:
        para_fd_set(signal_pipe, &rfds, &max_fileno);
        timeout = vss_preselect(&rfds, &wfds, &max_fileno);
        status_refresh();
-       for (i = 0; senders[i].name; i++) {
-               if (!senders[i].pre_select)
-                       continue;
-               senders[i].pre_select(&max_fileno, &rfds, &wfds);
-       }
        mmd_unlock();
        ret = para_select(max_fileno + 1, &rfds, &wfds, timeout);
        mmd_lock();
-       vss_post_select(&rfds, &wfds);
        if (ret < 0)
                goto repeat;
-       for (i = 0; senders[i].name; i++) {
-               if (!senders[i].post_select)
-                       continue;
-               senders[i].post_select(&rfds, &wfds);
-       }
-       vss_send_chunk();
+       vss_post_select(&rfds, &wfds);
        status_refresh();
        if (FD_ISSET(signal_pipe, &rfds)) {
                int sig;
@@ -527,14 +496,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;