[xiph-commits] r9226 - icecast/trunk/icecast/src

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Sat May 7 04:50:09 PDT 2005


Author: karl
Date: 2005-05-07 04:50:07 -0700 (Sat, 07 May 2005)
New Revision: 9226

Modified:
   icecast/trunk/icecast/src/slave.c
Log:
allow for changes in relay settings to trigger a relay restart


Modified: icecast/trunk/icecast/src/slave.c
===================================================================
--- icecast/trunk/icecast/src/slave.c	2005-05-07 11:01:35 UTC (rev 9225)
+++ icecast/trunk/icecast/src/slave.c	2005-05-07 11:50:07 UTC (rev 9226)
@@ -292,6 +292,25 @@
 }
 
 
+/* compare the 2 relays to see if there are any changes, return 1 if
+ * the relay needs to be restarted, 0 otherwise
+ */
+static int relay_has_changed (relay_server *new, relay_server *old)
+{
+    do
+    {
+        if (strcmp (new->mount, old->mount) != 0)
+            break;
+        if (strcmp (new->server, old->server) != 0)
+            break;
+        if (new->port != old->port)
+            break;
+        return 0;
+    } while (0);
+    return 1;
+}
+
+
 /* go through updated looking for relays that are different configured. The
  * returned list contains relays that should be kept running, current contains
  * the list of relays to shutdown
@@ -312,7 +331,8 @@
         {
             /* break out if keeping relay */
             if (strcmp (relay->localmount, existing_relay->localmount) == 0)
-                break;
+                if (relay_has_changed (relay, existing_relay) == 0)
+                    break;
             existing_p = &existing_relay->next;
             existing_relay = existing_relay->next;
         }



More information about the commits mailing list