]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - client_common.c
Support for UDPv4/v6 multicast streaming
[paraslash.git] / client_common.c
index 3522060895928758a52833d97b27baf669005bee..d5807e758d656df802647dd1039286770016ac29 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1997-2008 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 1997-2009 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -116,6 +116,8 @@ static void client_pre_select(struct sched *s, struct task *t)
                }
                return;
        case CL_SENDING:
+               if (!ct->in_loaded) /* stdin task not yet started */
+                       return;
                if (*ct->in_loaded) {
                        PARA_INFO_LOG("loaded: %zd\n", *ct->in_loaded);
                        para_fd_set(ct->fd, &s->wfds, &s->max_fileno);
@@ -317,7 +319,8 @@ err_out:
  *
  * \return Standard.
  */
-int client_open(int argc, char *argv[], struct client_task **ct_ptr)
+int client_open(int argc, char *argv[], struct client_task **ct_ptr,
+               int *loglevel)
 {
        char *home = para_homedir();
        struct stat statbuf;
@@ -326,7 +329,9 @@ int client_open(int argc, char *argv[], struct client_task **ct_ptr)
 
        *ct_ptr = ct;
        ct->fd = -1;
-       ret = client_cmdline_parser(argc, argv, &ct->conf);
+       ret = -E_CLIENT_SYNTAX;
+       if (client_cmdline_parser(argc, argv, &ct->conf))
+               goto out;
        HANDLE_VERSION_FLAG("client", ct->conf);
        ret = -E_CLIENT_SYNTAX;
        if (!ct->conf.inputs_num)
@@ -351,13 +356,17 @@ int client_open(int argc, char *argv[], struct client_task **ct_ptr)
                        .override = 0,
                        .initialize = 0,
                        .check_required = 0,
-                       .check_ambiguity = 0
+                       .check_ambiguity = 0,
+                       .print_errors = 0
                };
-               client_cmdline_parser_config_file(ct->config_file,
-                       &ct->conf, &params);
+               ret = -E_BAD_CONFIG;
+               if (client_cmdline_parser_config_file(ct->config_file,
+                       &ct->conf, &params))
+                       goto out;
        }
-       ret = 1;
-       PARA_INFO_LOG("loglevel: %d\n", ct->conf.loglevel_arg);
+       if (loglevel)
+               *loglevel = get_loglevel_by_name(ct->conf.loglevel_arg);
+       PARA_INFO_LOG("loglevel: %s\n", ct->conf.loglevel_arg);
        PARA_INFO_LOG("config_file: %s\n", ct->config_file);
        PARA_INFO_LOG("key_file: %s\n", ct->key_file);
        PARA_NOTICE_LOG("connecting %s:%d\n", ct->conf.hostname_arg,
@@ -372,4 +381,3 @@ out:
        }
        return ret;
 }
-