]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
integrate para_client into para_audiod
authorAndre <maan@p133.(none)>
Thu, 15 Jun 2006 10:43:27 +0000 (12:43 +0200)
committerAndre <maan@p133.(none)>
Thu, 15 Jun 2006 10:43:27 +0000 (12:43 +0200)
This allows major simplifications:

- get rid of exec.o: para_audiod no longer executes any external
  programs
- get rid of close_on_fork.o
- get rid of the sigchld handler.

25 files changed:
Makefile.in
NEWS
afs.c
audioc.c
audiod.c
audiod.h
client_common.c
command.c
configure.ac
dccp_send.c
fade.c
filter.c
grab_client.c
gui.c
http_recv.c
http_send.c
mysql_selector.c
ortp_send.c
random_selector.c
recv.c
sdl_gui.c
server.c
server.h
stat.c
write.c

index ed887fa4ba7ddaee7da86a7f809ec66177ff58b2..9a85952bd44533de3189bec4283c7f2b9acb6381 100644 (file)
@@ -141,10 +141,16 @@ grab_client.cmdline.h grab_client.cmdline.c: grab_client.ggo
                --func-name $(subst _write.ggo,,$<)_cmdline_parser < $<
 
 %.cmdline.h %.cmdline.c: %.ggo
-       case $< in client.ggo) O="--unamed-opts=command --arg-struct-name=$(subst .ggo,,$<)_args_info";; \
+       case $< in client.ggo) O="--unamed-opts=command";; \
                audioc.ggo) O="--unamed-opts=command";; \
        esac; \
-       gengetopt $$O --conf-parser --file-name=$(*F).cmdline --set-package="para_$(subst .cmdline,,$(*F))" --set-version="$V"  < $<
+       gengetopt $$O \
+               --conf-parser \
+               --file-name=$(*F).cmdline \
+               --func-name $(*F)_cmdline_parser \
+               --arg-struct-name=$(*F)_args_info \
+               --set-package="para_$(subst .cmdline,,$(*F))" \
+               --set-version="$V"  < $<
 
 aacdec.o: aacdec.c
        $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
diff --git a/NEWS b/NEWS
index 4a2941feb4a8ac566957b7114020211f1989059d..dd02a36a05f48ddd36a5721ba434a4e8c55856fb 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,7 +11,8 @@ A bunch of new features and core changes.
        - Support for m4a files via the new aac filter/ and audio
          format handler. (requires libfaad)
        - new writer: osxplay (thanks to Gerd Becker)
-       - writers are integrated into para_audiod
+       - writers are integrated in para_audiod
+       - para_client is integrated in para_audiod
        - each writer of para_write has its own command line parser,
          just like para_recv and para_filter.
        - random/playlist selector: improved info strings
diff --git a/afs.c b/afs.c
index 608bdde87e3fc32de56739f119b05b619310108a..49aabafb30fd7dd4e743d3fd9bfd3cab916d8a7d 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -41,7 +41,6 @@ static struct timeval eof_barrier;
 extern struct misc_meta_data *mmd;
 extern struct audio_file_selector selectors[];
 extern struct sender senders[];
-extern struct gengetopt_args_info conf;
 
 static FILE *audio_file = NULL;
 
index 1723114fc37221bc18d1480dd4c375972955d9fc..0f4c5c5084d8dbf31c726ae6d3e5ccf67bcb7d29 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -27,7 +27,7 @@
 
 INIT_AUDIOC_ERRLISTS;
 
-struct gengetopt_args_info conf;
+struct audioc_args_info conf;
 char *tmpfifo;
 
 
@@ -81,11 +81,11 @@ int main(int argc, char *argv[])
                *buf = NULL, *hn = para_hostname(), *args, *home = para_homedir();
 
 
-       if (cmdline_parser(argc, argv, &conf))
+       if (audioc_cmdline_parser(argc, argv, &conf))
                goto out;
        cf = configfile_exists();
        if (cf) {
-               if (cmdline_parser_configfile(cf, &conf, 0, 0, 0)) {
+               if (audioc_cmdline_parser_configfile(cf, &conf, 0, 0, 0)) {
                        fprintf(stderr, "parse error in config file\n");
                        exit(EXIT_FAILURE);
                }
index 8b9f181b80edfb74b31ec08aed23d61d74c8c19f..032b608cbc3acb32e537350fffba2a01aa27c099 100644 (file)
--- a/audiod.c
+++ b/audiod.c
 
 #include "audiod.cmdline.h"
 #include "list.h"
-#include "close_on_fork.h"
 #include "sched.h"
 #include "recv.h"
 #include "filter.h"
 #include "grab_client.cmdline.h"
 #include "grab_client.h"
-
-#include "error.h"
+#include "client.cmdline.h"
+#include "client.h"
 #include "audiod.h"
 #include "net.h"
 #include "daemon.h"
@@ -37,6 +36,7 @@
 #include "fd.h"
 #include "write.h"
 #include "write_common.h"
+#include "error.h"
 
 /** define the array of error lists needed by para_audiod */
 INIT_AUDIOD_ERRLISTS;
@@ -70,7 +70,7 @@ struct slot_info slot[MAX_STREAM_SLOTS];
 
 int audiod_status = AUDIOD_ON;
 
-struct gengetopt_args_info conf;
+struct audiod_args_info conf;
 static char *socket_name;
 static FILE *logfile;
 static struct audio_format_info afi[NUM_AUDIO_FORMATS];
@@ -163,10 +163,8 @@ static void setup_signal_handling(void)
        PARA_INFO_LOG("signal pipe: fd %d\n", sig_task->fd);
        para_install_sighandler(SIGINT);
        para_install_sighandler(SIGTERM);
-       para_install_sighandler(SIGCHLD);
        para_install_sighandler(SIGHUP);
-       para_install_sighandler(SIGPIPE);
-//     signal(SIGPIPE, SIG_IGN);
+       signal(SIGPIPE, SIG_IGN);
 }
 
 static void clear_slot(int slot_num)
@@ -261,13 +259,10 @@ static void close_stat_pipe(void)
 {
        int i;
 
-       if (stat_task->fd < 0)
+       if (!stat_task->pcd)
                return;
-       PARA_NOTICE_LOG("%s", "closing status pipe\n");
-       close(stat_task->fd);
-       del_close_on_fork_list(stat_task->fd);
-       stat_task->fd = -1;
-//     kill_all_decoders();
+       client_close(stat_task->pcd);
+       stat_task->pcd = NULL;
        for (i = 0; i < NUM_STAT_ITEMS; i++) {
                free(stat_task->stat_item_values[i]);
                stat_task->stat_item_values[i] = NULL;
@@ -449,7 +444,7 @@ static int open_current_receiver(struct sched *s)
        int i;
        struct timeval diff;
 
-       if (!stat_task->af_status)
+       if (!stat_task->af_status || !stat_task->pcd)
                return 0;
        i = get_audio_format_num(stat_task->af_status);
        if (i < 0)
@@ -554,13 +549,6 @@ static void check_stat_line(char *line)
 static void handle_signal(int sig)
 {
        switch (sig) {
-       case SIGCHLD:
-               for (;;) {
-                       pid_t pid = para_reap_child();
-                       if (pid <= 0)
-                               return;
-                       PARA_CRIT_LOG("para_client died (pid %d)\n", pid);
-               }
        case SIGINT:
        case SIGTERM:
        case SIGHUP:
@@ -880,26 +868,10 @@ static int audiod_get_socket(void)
                PARA_EMERG_LOG("%s", "can not listen on socket\n");
                exit(EXIT_FAILURE); /* do not unlink socket */
        }
-       add_close_on_fork_list(fd);
        mark_fd_nonblock(fd);
        return fd;
 }
 
-static int open_stat_pipe(void)
-{
-       int ret, fd[3] = {-1, 1, 0};
-       pid_t pid;
-       ret = para_exec_cmdline_pid(&pid, BINDIR "/para_client stat", fd);
-       if (ret >= 0) {
-               ret = fd[1];
-               PARA_NOTICE_LOG("stat pipe opened, fd %d\n", ret);
-               add_close_on_fork_list(ret);
-               mark_fd_nonblock(ret);
-       } else
-               clean_exit(EXIT_FAILURE, "failed to open status pipe");
-       return ret;
-}
-
 void signal_event_handler(struct task *t)
 {
        struct signal_task *st = t->private_data;
@@ -968,6 +940,15 @@ static void init_command_task(struct command_task *ct)
        sprintf(ct->task.status, "command task");
 }
 
+static void client_task_event_handler(__a_unused struct task *t)
+{
+       struct private_client_data *pcd = t->private_data;
+       if (t->ret == -E_HANDSHAKE_COMPLETE)
+               return;
+       unregister_task(t);
+       pcd->eof = 1;
+}
+
 static void status_event_handler(__a_unused struct task *t)
 {
        struct timeval delay = {1, 0};
@@ -985,34 +966,34 @@ static void status_event_handler(__a_unused struct task *t)
 static void status_pre_select(struct sched *s, struct task *t)
 {
        struct status_task *st = t->private_data;
+       int argc = 2;
+       char *argv[] = {"audiod", "stat", NULL};
        t->ret = 1;
-       if (st->fd >= 0 && audiod_status == AUDIOD_OFF)
+       if (st->pcd && (audiod_status == AUDIOD_OFF || st->pcd->eof))
                close_stat_pipe();
-       if (st->fd < 0 && audiod_status != AUDIOD_OFF
+       if (!st->pcd && audiod_status != AUDIOD_OFF
                && tv_diff(now, &st->restart_barrier, NULL) > 0) {
-               st->fd = open_stat_pipe();
-               st->loaded = 0;
-               st->buf[0] = '\0';
+               t->ret = client_parse_config(argc, argv, &st->pcd);
+               if (t->ret < 0)
+                       return;
+               t->ret = client_open(st->pcd);
+               if (t->ret < 0)
+                       return;
+               st->pcd->task.event_handler = client_task_event_handler;
+               s->timeout.tv_sec = 0;
+               s->timeout.tv_usec = 1;
        }
-       if (st->fd >= 0 && audiod_status != AUDIOD_OFF)
-               para_fd_set(st->fd, &s->rfds, &s->max_fileno);
 }
 
-static void status_post_select(struct sched *s, struct task *t)
+static void status_post_select(__a_unused struct sched *s, struct task *t)
 {
        struct status_task *st = t->private_data;
 
        t->ret = 1;
-       if (st->fd < 0 || !FD_ISSET(st->fd, &s->rfds))
-               return;
-       t->ret = read(st->fd, st->buf + st->loaded, STRINGSIZE - 1 - st->loaded);
-       if (t->ret <= 0) {
-               if (!t->ret)
-                       t->ret = -E_STATUS_EOF;
+       if (!st->pcd || !st->pcd->loaded
+                       || st->pcd->status != CL_RECEIVING_SERVER_OUTPUT)
                return;
-       }
-       st->buf[t->ret + st->loaded] = '\0';
-       st->loaded = for_each_line(st->buf, t->ret + st->loaded,
+       st->pcd->loaded = for_each_line(st->pcd->buf, st->pcd->loaded,
                &check_stat_line);
 }
 
@@ -1023,7 +1004,6 @@ static void init_status_task(struct status_task *st)
        st->task.post_select = status_post_select;
        st->task.event_handler = status_event_handler;
        st->task.private_data = st;
-       st->fd = -1;
        st->sa_time_diff_sign = 1;
        sprintf(st->task.status, "status task");
 }
@@ -1054,11 +1034,11 @@ int main(int argc, char *argv[])
        struct task audiod_task_struct, *audiod_task = &audiod_task_struct;
 
        valid_fd_012();
-       cmdline_parser(argc, argv, &conf);
+       audiod_cmdline_parser(argc, argv, &conf);
        para_drop_privileges(conf.user_arg, conf.group_arg);
        cf = configfile_exists();
        if (cf) {
-               if (cmdline_parser_configfile(cf, &conf, 0, 0, 0)) {
+               if (audiod_cmdline_parser_configfile(cf, &conf, 0, 0, 0)) {
                        PARA_EMERG_LOG("%s", "parse error in config file\n");
                        exit(EXIT_FAILURE);
                }
@@ -1091,7 +1071,7 @@ int main(int argc, char *argv[])
        register_task(&cmd_task->task);
        register_task(&stat_task->task);
        register_task(audiod_task);
-       s.default_timeout.tv_sec = 3;
+       s.default_timeout.tv_sec = 0;
        s.default_timeout.tv_usec = 99 * 1000;
        ret = sched(&s);
 
index f77ebcd1c8d61f5b5f7c5b78268c1743ac0f8448..c8d5fc2ea704d19d77b3db50b399e7d28c0497f5 100644 (file)
--- a/audiod.h
+++ b/audiod.h
@@ -54,16 +54,11 @@ struct audiod_task {
  * \sa struct task, struct sched
  */
 struct status_task {
-       /** the output of the stat command is read from this fd */
-       int fd;
-       /** stat data is stored here */
-       char buf[STRINGSIZE];
-       /** number of bytes loaded in \a buf */
-       unsigned loaded;
+       /** the associated task structure of audiod */
+       struct task task;
+       struct private_client_data *pcd;
        /** the array of status items sent by para_server */
        char *stat_item_values[NUM_STAT_ITEMS];
-       /** the associated task structure */
-       struct task task;
        /** do not restart client command until this time */
        struct timeval restart_barrier;
        /** the offset value announced by para_server */
@@ -84,7 +79,7 @@ struct status_task {
 
 extern struct status_task *stat_task;
 extern struct slot_info slot[MAX_STREAM_SLOTS];
-extern struct gengetopt_args_info conf;
+extern struct audiod_args_info conf;
 extern int audiod_status;
 extern const char *status_item_list[NUM_STAT_ITEMS];
 
index 330c9f7028b9b67fbddaad39ec4dd843a8ec4d8d..c2ae2d315fc650f0e4fc6bd1dc267d34800a2983 100644 (file)
@@ -27,6 +27,7 @@
 #include "net.h"
 #include "fd.h"
 #include "string.h"
+#include "client.cmdline.h"
 #include "client.h"
 #include "error.h"
 
@@ -67,7 +68,7 @@ int client_parse_config(int argc, char *argv[],
                para_calloc(sizeof(struct private_client_data));
 
        pcd->fd = -1;
-       cmdline_parser(argc, argv, &pcd->conf);
+       client_cmdline_parser(argc, argv, &pcd->conf);
        ret = - E_CLIENT_SYNTAX;
        if (!pcd->conf.inputs_num)
                goto out;
@@ -87,7 +88,8 @@ int client_parse_config(int argc, char *argv[],
                goto out;
        }
        if (!ret)
-               cmdline_parser_configfile(pcd->config_file, &pcd->conf, 0, 0, 0);
+               client_cmdline_parser_configfile(pcd->config_file,
+                       &pcd->conf, 0, 0, 0);
        ret = 1;
        *pcd_ptr = pcd;
        PARA_INFO_LOG(
@@ -111,7 +113,6 @@ void client_pre_select(struct sched *s, struct task *t)
 {
        struct private_client_data *pcd = t->private_data;
 
-       PARA_INFO_LOG("status %d\n", pcd->status);
        t->ret = 1;
        pcd->check_r = 0;
        pcd->check_w = 0;
@@ -171,7 +172,7 @@ void client_post_select(struct sched *s, struct task *t)
 {
        struct private_client_data *pcd = t->private_data;
 
-       PARA_INFO_LOG("status %d\n", pcd->status);
+//     PARA_INFO_LOG("status %d\n", pcd->status);
        t->ret = 1;
        if (pcd->fd < 0)
                return;
@@ -228,7 +229,7 @@ void client_post_select(struct sched *s, struct task *t)
                if (t->ret < 0)
                        return;
                bytes_received = t->ret;
-               PARA_INFO_LOG("++++ server info ++++\n%s\n++++ end of server "
+               PARA_DEBUG_LOG("++++ server info ++++\n%s\n++++ end of server "
                        "info ++++\n", pcd->buf);
                /* check if server has sent "Proceed" message */
                t->ret = -E_CLIENT_AUTH;
@@ -259,7 +260,7 @@ void client_post_select(struct sched *s, struct task *t)
                        free(tmp);
                }
                command = para_strcat(command, EOC_MSG "\n");
-               PARA_INFO_LOG("--> %s\n", command);
+               PARA_DEBUG_LOG("--> %s\n", command);
                t->ret = send_buffer(pcd->fd, command);
                free(command);
                if (t->ret > 0)
index 9098ad3c21d257c02b90e7a5ca1eee8c3d6b1759..ea42ef4318119a13b0fd077fc7500913161bbe93 100644 (file)
--- a/command.c
+++ b/command.c
@@ -38,7 +38,6 @@ static unsigned char rc4_buf[2 * RC4_KEY_LEN];
 
 extern const char *status_item_list[NUM_STAT_ITEMS];
 extern struct misc_meta_data *mmd;
-extern struct gengetopt_args_info conf;
 extern struct audio_file_selector selectors[];
 extern struct sender senders[];
 extern char *user_list;
index 49b3198abd066bf1b4d8e281fcb0609b5161d3a3..edb0637aeffdf3b65aa533586fb81fedfc5e4a69 100644 (file)
@@ -68,10 +68,11 @@ audioc_cmdline_objs="audioc.cmdline"
 audioc_errlist_objs="audioc string net fd"
 
 audiod_cmdline_objs="audiod.cmdline grab_client.cmdline compress_filter.cmdline
-       http_recv.cmdline dccp_recv.cmdline file_write.cmdline"
-audiod_errlist_objs="audiod exec close_on_fork signal string daemon stat net
+       http_recv.cmdline dccp_recv.cmdline file_write.cmdline client.cmdline"
+audiod_errlist_objs="audiod signal string daemon stat net
        time grab_client filter_chain wav compress http_recv dccp dccp_recv
-       recv_common fd sched write_common file_writer audiod_command"
+       recv_common fd sched write_common file_writer audiod_command crypt
+       client_common"
 audiod_ldflags=""
 
 server_cmdline_objs="server.cmdline"
@@ -137,6 +138,7 @@ if test "$enable_ssldir" = "yes"; then enable_ssldir=""; fi
 CHECK_SSL($enable_ssldir)
 server_ldflags="$srver_ldflags $SSL_LDFLAGS $SSL_LIBS"
 client_ldflags="$client_ldflags $SSL_LDFLAGS $SSL_LIBS"
+audiod_ldflags="$audiod_ldflags $SSL_LDFLAGS $SSL_LIBS"
 
 ########################################################################### ucred
 
index cfff30933ca5a57fc7ecf6f3d5cb06a5a9481ef3..08930ad1852321f877fac474b839ea71bc5ee5d8 100644 (file)
@@ -34,7 +34,7 @@
 #include "fd.h"
 #include "close_on_fork.h"
 #include "server.cmdline.h"
-extern struct gengetopt_args_info conf;
+
 /** the list of connected clients **/
 static struct list_head clients;
 static int listen_fd = -1;
diff --git a/fade.c b/fade.c
index ceb91dafb974ab34e7c6bc89d5195c64c0d8be30..b42e4a1c713c6b660c4c32a2c382bcef7f82cac4 100644 (file)
--- a/fade.c
+++ b/fade.c
@@ -34,7 +34,7 @@
 #include "string.h"
 
 
-struct gengetopt_args_info args_info;
+struct fade_args_info args_info;
 
 void para_log(__a_unused int ll, const char *fmt,...)
 {
@@ -279,7 +279,7 @@ int main(int argc, char *argv[])
 {
        int ret;
 
-       if (cmdline_parser(argc, argv, &args_info))
+       if (fade_cmdline_parser(argc, argv, &args_info))
                exit(EXIT_FAILURE);
        ret = configfile_exists();
        if (!ret && args_info.config_file_given) {
@@ -288,7 +288,7 @@ int main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        }
        if (ret)
-               cmdline_parser_configfile(args_info.config_file_arg,
+               fade_cmdline_parser_configfile(args_info.config_file_arg,
                        &args_info, 0, 0, 0);
        if ((ret = open_mixer()) < 0) {
                PARA_EMERG_LOG("can not open mixer device %s.",
index f49042f8c7ecfe901bcb01b5ef889d12e93b71b5..0d1c2e243b4e21c221a5abcd23a4f93fa1dce228 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -37,7 +37,7 @@ static struct filter_chain *fc = &filter_chain_struct;
 static struct stdout_task stdout_task_struct;
 static struct stdout_task *sot = &stdout_task_struct;
 
-struct gengetopt_args_info conf;
+struct filter_args_info conf;
 
 __printf_2_3 void para_log(int ll, const char* fmt,...)
 {
@@ -113,7 +113,7 @@ static int parse_config(int argc, char *argv[])
        struct stat statbuf;
        int i;
 
-       if (cmdline_parser(argc, argv, &conf))
+       if (filter_cmdline_parser(argc, argv, &conf))
                return -E_FILTER_SYNTAX;
        if (!cf) {
                char *home = para_homedir();
@@ -121,7 +121,7 @@ static int parse_config(int argc, char *argv[])
                free(home);
        }
        if (!stat(cf, &statbuf)) {
-               if (cmdline_parser_configfile(cf, &conf, 0, 0, 0))
+               if (filter_cmdline_parser_configfile(cf, &conf, 0, 0, 0))
                        return -E_FILTER_SYNTAX;
        }
        if (!conf.list_filters_given)
index f505fa8739070d4a9a01563c2e60a8395fdea70a..735e5b4bc90739c0c55991eaffcaf76f02841ea0 100644 (file)
@@ -24,7 +24,6 @@
  */
 
 #include "para.h"
-#include "close_on_fork.h"
 #include "grab_client.cmdline.h"
 #include "list.h"
 #include "sched.h"
@@ -145,7 +144,6 @@ static void gc_close(struct filter_callback *fcb)
 
        if (gc->conf->one_shot_given || gc->error) {
                PARA_INFO_LOG("closing fd %d (grab client %p)\n", gc->fd, gc);
-               del_close_on_fork_list(gc->fd);
                close(gc->fd);
                gc_free(gc);
                /* close on fork ?*/
diff --git a/gui.c b/gui.c
index 49f8f46f523742eab96346103830b5dadc9b3416..8b1b39a876e3ea84cc6cde1800edb4df3bdf026a 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -61,7 +61,7 @@ static pid_t external_cmd_pid;
 
 static int command_pipe = -1;
 static int audiod_pipe = -1;
-static struct gengetopt_args_info conf;
+static struct gui_args_info conf;
 
 enum {GETCH_MODE, COMMAND_MODE, EXTERNAL_MODE};
 
@@ -1157,8 +1157,8 @@ static void com_reread_conf(void)
                return;
        }
        PARA_INFO_LOG("%s", "rereading command line options and config file");
-       cmdline_parser(_argc, _argv, &conf);
-       cmdline_parser_configfile(cf, &conf, 1, 1, 0);
+       gui_cmdline_parser(_argc, _argv, &conf);
+       gui_cmdline_parser_configfile(cf, &conf, 1, 1, 0);
        PARA_NOTICE_LOG("%s", "configuration read");
        if (check_key_map_args() < 0)
                finish(EXIT_FAILURE);
@@ -1315,7 +1315,7 @@ int main(int argc, char *argv[])
        _argc = argc;
        _argv = argv;
 
-       if (cmdline_parser(argc, argv, &conf)) {
+       if (gui_cmdline_parser(argc, argv, &conf)) {
                fprintf(stderr, "parse error while reading command line\n");
                exit(EXIT_FAILURE);
        }
@@ -1332,7 +1332,7 @@ int main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        }
        if (cf)
-               cmdline_parser_configfile(cf, &conf, 0, 0, 0);
+               gui_cmdline_parser_configfile(cf, &conf, 0, 0, 0);
        if (check_key_map_args() < 0) {
                fprintf(stderr, "invalid key map in config file\n");
                exit(EXIT_FAILURE);
index 096541679ea5ae30116f478436c2303c1aabf567..6a2f60f1b1b945befd179a28d609ea88e54938e4 100644 (file)
@@ -121,7 +121,7 @@ static void http_recv_post_select(struct sched *s, struct task *t)
                if (!FD_ISSET(phd->fd, &s->wfds))
                        goto out;
                rq = make_request_msg();
-               PARA_NOTICE_LOG("%s", "sending http request\n");
+               PARA_INFO_LOG("%s", "sending http request\n");
                t->ret = send_va_buffer(phd->fd, "%s", rq);
                free(rq);
                if (t->ret > 0)
@@ -134,7 +134,7 @@ static void http_recv_post_select(struct sched *s, struct task *t)
                t->ret = recv_pattern(phd->fd, HTTP_OK_MSG, MAXLINE);
                if (t->ret < 0)
                        goto out;
-               PARA_NOTICE_LOG("%s", "received ok msg, streaming\n");
+               PARA_INFO_LOG("%s", "received ok msg, streaming\n");
                t->ret = 1;
                phd->status = HTTP_STREAMING;
                goto out;
@@ -184,7 +184,6 @@ static int http_recv_open(struct receiver_node *rn)
        rn->buf = para_calloc(BUFSIZE);
        rn->private_data = para_calloc(sizeof(struct private_http_recv_data));
        phd = rn->private_data;
-       PARA_NOTICE_LOG("phd = %p, rn = %p\n", phd, rn);
        ret = get_host_info(conf->host_arg, &he);
        if (!ret < 0)
                goto err_out;
index 5eebba5612bd845190bc573fe3d73895e7c60c50..f0c9851fbe722889a46f12ff39741a7298b5929f 100644 (file)
@@ -38,8 +38,6 @@
 #define HTTP_ERR_MSG "HTTP/1.0 400 Bad Request\n"
 /** \endcond */
 
-extern struct gengetopt_args_info conf;
-
 /** the possible states of a client from the server's POV */
 enum http_status {
        HTTP_CONNECTED,
index e2c9562c7aa64bb14e4f5f4830ca0117130aaa63..054c797ebcd10e66635197b73dc7548449bc6bce 100644 (file)
@@ -32,7 +32,6 @@
 #include "net.h"
 #include "string.h"
 
-extern struct gengetopt_args_info conf;
 /** pointer to the shared memory area */
 extern struct misc_meta_data *mmd;
 
index 9d244225d39f557fc1a7132b0173e2d8b0269c16..dd4ee88409c3155853150c62736c6fa40ee4573c 100644 (file)
@@ -32,8 +32,6 @@
 #define TARGET_ADDR(oc) inet_ntoa((oc)->addr)
 /** \endcond */
 
-extern struct gengetopt_args_info conf;
-
 /** describes one entry in the list of targets for the ortp sender */
 struct ortp_target {
 /** address info */
index 3bd637d54d47edb62f217b2831c3588cc508c7ca..123425b0b8d3df18a5b624481babd5e2ae61b666 100644 (file)
@@ -27,7 +27,6 @@
 #include "string.h"
 
 static int com_random_info(int, int, char **);
-extern struct gengetopt_args_info conf;
 extern struct misc_meta_data *mmd;
 
 static unsigned int num_audio_files, audio_file_count;
diff --git a/recv.c b/recv.c
index 555b7c51d1c554ea02340443cd3d431fedcc3c63..bfc7a45d3572fb7c02e19cf9608883723df95e38 100644 (file)
--- a/recv.c
+++ b/recv.c
@@ -25,7 +25,7 @@
 #include "error.h"
 #include "stdout.h"
 
-struct gengetopt_args_info conf;
+struct recv_args_info conf;
 
 INIT_RECV_ERRLISTS;
 
@@ -45,7 +45,7 @@ static void *parse_config(int argc, char *argv[], int *receiver_num)
 {
        int i;
 
-       if (cmdline_parser(argc, argv, &conf))
+       if (recv_cmdline_parser(argc, argv, &conf))
                return NULL;
        if (conf.list_receivers_given) {
                printf("available receivers: ");
index a8c0327ad860a09ad2100c84e52735486510e128..c30465e57e1f74fe47c2fb34e10d134ad7624c5d 100644 (file)
--- a/sdl_gui.c
+++ b/sdl_gui.c
@@ -43,7 +43,7 @@ static int width = 0;
 static int height = 0;
 
 extern const char *status_item_list[NUM_STAT_ITEMS];
-struct gengetopt_args_info args_info;
+struct sdl_gui_args_info args_info;
 
 #define FRAME_WIDTH 10
 #define FONT_HEIGHT 36
@@ -742,7 +742,7 @@ int main(int argc, char *argv[])
        int i, ret, pipe;
        SDLKey sym;
 
-       cmdline_parser(argc, argv, &args_info);
+       sdl_gui_cmdline_parser(argc, argv, &args_info);
        ret = configfile_exists();
 //     printf("w=%i,h=%i,ret=%i, cf=%s\n", width, height, ret, args_info.config_file_arg);
 
@@ -752,7 +752,7 @@ int main(int argc, char *argv[])
                exit(EXIT_FAILURE);
        }
        if (ret)
-               cmdline_parser_configfile(args_info.config_file_arg,
+               sdl_gui_cmdline_parser_configfile(args_info.config_file_arg,
                        &args_info, 0, 0, 0);
        signal(SIGCHLD, SIG_IGN);
        width = args_info.width_arg;
index 2391e07c360d93f68e85a76c99bc783e1f2d4bc0..ce56494f4fce68d0ce3f1499b8e00ee609d9b05e 100644 (file)
--- a/server.c
+++ b/server.c
@@ -56,7 +56,7 @@ struct misc_meta_data *mmd;
  * It also contains the options for all audio file selectors and all supported
  * senders.
 */
-struct gengetopt_args_info conf;
+struct server_args_info conf;
 char *user_list = NULL;
 extern void dccp_send_init(struct sender *);
 extern void http_send_init(struct sender *);
@@ -234,7 +234,7 @@ static void parse_config(int override)
        }
        if (!ret) {
                int tmp = conf.daemon_given;
-               cmdline_parser_configfile(cf, &conf, override, 0, 0);
+               server_cmdline_parser_configfile(cf, &conf, override, 0, 0);
                conf.daemon_given = tmp;
        }
        /* logfile */
@@ -339,7 +339,7 @@ static unsigned do_inits(int argc, char **argv)
 
        init_random_seed();
        /* parse command line options */
-       cmdline_parser(argc, argv, &conf);
+       server_cmdline_parser(argc, argv, &conf);
        para_drop_privileges(conf.user_arg, conf.group_arg);
        /* parse config file, open log and set defaults */
        parse_config(0);
index 7f10a9fcd455bf06df0a68ba7f52b2c90cb9fecc..9d18561e0f8e1eb20300759cc597970795abe887 100644 (file)
--- a/server.h
+++ b/server.h
@@ -149,6 +149,7 @@ struct misc_meta_data{
        struct sender_command_data sender_cmd_data;
 };
 
+extern struct server_args_info conf;
 
 int handle_connect(int fd, struct sockaddr_in *addr);
 void mmd_unlock(void);
diff --git a/stat.c b/stat.c
index 9def50759cf22706860b9d0ddea4e488247a839b..39aab43ebd256a6de2e20015e4519ed98b77c761 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -129,7 +129,6 @@ int stat_client_add(int fd, long unsigned mask)
        new_client = para_malloc(sizeof(struct stat_client));
        new_client->fd = fd;
        new_client->item_mask = mask;
-       add_close_on_fork_list(fd);
        list_add(&new_client->node, &client_list);
        dump_stat_client_list();
        num_clients++;
@@ -171,7 +170,6 @@ void stat_client_write(char *msg, int itemnum)
                }
                /* write error or fd not ready for writing */
                close(fd);
-               del_close_on_fork_list(fd);
                num_clients--;
                PARA_INFO_LOG("deleting client on fd %d\n", fd);
                list_del(&sc->node);
diff --git a/write.c b/write.c
index 66cdd7f0c6f15870e5af6752f67b9e395bb749be..498dd78d08c8f90a9334fcaf1d5f4d7820df81ec 100644 (file)
--- a/write.c
+++ b/write.c
@@ -43,7 +43,7 @@ struct initial_delay_task {
        struct task task;
 };
 
-static struct gengetopt_args_info conf;
+static struct write_args_info conf;
 struct stdin_task sit;
 struct check_wav_task cwt;
 struct initial_delay_task idt;
@@ -212,7 +212,7 @@ int main(int argc, char *argv[])
        int ret = -E_WRITE_SYNTAX;
        struct sched s;
 
-       cmdline_parser(argc, argv, &conf);
+       write_cmdline_parser(argc, argv, &conf);
        init_supported_writers();
 
        wng = check_args();