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

Michael Smith msmith at xiph.org
Wed Feb 12 03:04:26 PST 2003



msmith      03/02/12 06:04:26

  Modified:    src      config.c config.h slave.c
  Log:
  Allow configuring local mountpoint seperately from remote mountpoint

Revision  Changes    Path
1.26      +6 -0      icecast/src/config.c

Index: config.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/config.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- config.c	11 Feb 2003 14:23:34 -0000	1.25
+++ config.c	12 Feb 2003 11:04:26 -0000	1.26
@@ -109,6 +109,8 @@
         nextrelay = relay->next;
         xmlFree(relay->server);
         xmlFree(relay->mount);
+        if(relay->localmount)
+            xmlFree(relay->localmount);
         free(relay);
         relay = nextrelay;
     }
@@ -417,6 +419,10 @@
         }
         else if (strcmp(node->name, "mount") == 0) {
                         relay->mount = (char *)xmlNodeListGetString(
+                    doc, node->xmlChildrenNode, 1);
+        }
+        else if (strcmp(node->name, "local-mount") == 0) {
+			relay->localmount = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
         }
         } while ((node = node->next));

<p><p>1.15      +1 -0      icecast/src/config.h

Index: config.h
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/config.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- config.h	11 Feb 2003 14:23:34 -0000	1.14
+++ config.h	12 Feb 2003 11:04:26 -0000	1.15
@@ -19,6 +19,7 @@
     char *server;
     int port;
     char *mount;
+    char *localmount;
     struct _relay_server *next;
 } relay_server;
 

<p><p>1.17      +11 -6     icecast/src/slave.c

Index: slave.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/slave.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- slave.c	7 Feb 2003 14:00:33 -0000	1.16
+++ slave.c	12 Feb 2003 11:04:26 -0000	1.17
@@ -65,7 +65,8 @@
         thread_join(_slave_thread_id);
 }
 
-static void create_relay_stream(char *server, int port, char *mount)
+static void create_relay_stream(char *server, int port, 
+        char *remotemount, char *localmount)
 {
     sock_t streamsock;
         char header[4096];
@@ -73,7 +74,10 @@
         http_parser_t *parser;
     client_t *client;
 
-    DEBUG1("Adding source at mountpoint \"%s\"", mount);
+    if(!localmount)
+        localmount = remotemount;
+
+    DEBUG1("Adding source at mountpoint \"%s\"", localmount);
 
         streamsock = sock_connect_wto(server, port, 0);
         if (streamsock == SOCK_ERROR) {
@@ -81,7 +85,7 @@
         return;
         }
         con = create_connection(streamsock, NULL);
-	sock_write(streamsock, "GET %s HTTP/1.0\r\n\r\n", mount);
+	sock_write(streamsock, "GET %s HTTP/1.0\r\n\r\n", remotemount);
         memset(header, 0, sizeof(header));
         if (util_read_header(con->sock, header, 4096) == 0) {
                 connection_close(con);
@@ -89,7 +93,7 @@
         }
         parser = httpp_create_parser();
         httpp_initialize(parser, NULL);
-	if(!httpp_parse_response(parser, header, strlen(header), mount)) {
+	if(!httpp_parse_response(parser, header, strlen(header), localmount)) {
         if(httpp_getvar(parser, HTTPP_VAR_ERROR_MESSAGE)) {
             ERROR1("Error parsing relay request: %s", 
                     httpp_getvar(parser, HTTPP_VAR_ERROR_MESSAGE));
@@ -164,7 +168,7 @@
                     create_relay_stream(
                             config_get_config()->master_server,
                             config_get_config()->master_server_port,
-                            buf);
+                            buf, NULL);
                             } 
                 else
                                 avl_tree_unlock(global.source_tree);
@@ -179,7 +183,8 @@
             if(!source_find_mount(relay->mount)) {
                 avl_tree_unlock(global.source_tree);
 
-                create_relay_stream(relay->server, relay->port, relay->mount);
+                create_relay_stream(relay->server, relay->port, relay->mount,
+                        relay->localmount);
             }
             else
                 avl_tree_unlock(global.source_tree);

<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