[xiph-cvs] cvs commit: icecast/src slave.c

Karl Heyes karl at xiph.org
Wed Dec 17 15:03:39 PST 2003



karl        03/12/17 18:03:39

  Modified:    src      slave.c
  Log:
  Fetching the stream list was failing after the config file was re-read.

Revision  Changes    Path
1.29      +10 -9     icecast/src/slave.c

Index: slave.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/slave.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- slave.c	12 Dec 2003 23:06:44 -0000	1.28
+++ slave.c	17 Dec 2003 23:03:38 -0000	1.29
@@ -142,22 +142,16 @@
     char *authheader, *data;
     int len;
     char *username = "relay";
-    char *password;
     int max_interval;
     relay_server *relay;
     ice_config_t *config;
     
     config = config_get_config();
 
-    password = config->master_password;
     interval = max_interval = config->master_update_interval;
 
-    if(password == NULL)
-        password = config->source_password;
-
     config_release_config();
 
-
     while (_initialized) {
         if (max_interval > ++interval) {
             thread_sleep(1000000);
@@ -167,21 +161,26 @@
             /* In case it's been reconfigured */
             config = config_get_config();
             max_interval = config->master_update_interval;
-            config_release_config();
 
             interval = 0;
         }
 
-        config = config_get_config();
         if(config->master_server != NULL) {
-            char *server = config->master_server;
+            char *server = strdup (config->master_server);
             int port = config->master_server_port;
+            char *password = NULL;
+            if (config->master_password != NULL)
+                password = strdup (config->master_password);
+            else
+                password = strdup (config->source_password);
             config_release_config();
 
             mastersock = sock_connect_wto(server, port, 0);
 
             if (mastersock == SOCK_ERROR) {
                 WARN0("Relay slave failed to contact master server to fetch stream list");
+                free (server);
+                free (password);
                 continue;
             }
 
@@ -212,6 +211,8 @@
                 else
                     avl_tree_unlock(global.source_tree);
             }
+            free (server);
+            free (password);
             sock_close(mastersock);
         }
         else {

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list