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

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Mon May 30 19:48:43 PDT 2005


Author: karl
Date: 2005-05-30 19:48:40 -0700 (Mon, 30 May 2005)
New Revision: 9331

Modified:
   icecast/trunk/icecast/src/format.c
   icecast/trunk/icecast/src/slave.c
   icecast/trunk/icecast/src/source.c
   icecast/trunk/icecast/src/source.h
   icecast/trunk/icecast/src/yp.c
Log:
missed a merge for stats update for when the relay ends.  The rest is minor
stuff, type check cleanup and code reduction in YP


Modified: icecast/trunk/icecast/src/format.c
===================================================================
--- icecast/trunk/icecast/src/format.c	2005-05-31 02:40:23 UTC (rev 9330)
+++ icecast/trunk/icecast/src/format.c	2005-05-31 02:48:40 UTC (rev 9331)
@@ -54,10 +54,10 @@
         return FORMAT_TYPE_OGG; /* Backwards compatibility */
     else if(strcmp(contenttype, "application/ogg") == 0)
         return FORMAT_TYPE_OGG; /* Now blessed by IANA */
-    else 
+    else
         /* We default to the Generic format handler, which
            can handle many more formats than just mp3 */
-        return FORMAT_TYPE_GENERIC; 
+        return FORMAT_TYPE_GENERIC;
 }
 
 int format_get_plugin(format_type_t type, source_t *source)

Modified: icecast/trunk/icecast/src/slave.c
===================================================================
--- icecast/trunk/icecast/src/slave.c	2005-05-31 02:40:23 UTC (rev 9330)
+++ icecast/trunk/icecast/src/slave.c	2005-05-31 02:48:40 UTC (rev 9331)
@@ -292,7 +292,6 @@
         relay->thread = NULL;
         relay->cleanup = 0;
         relay->running = 0;
-        update_settings = 1;
     }
 }
 
@@ -385,12 +384,18 @@
 
     while (to_free)
     {
-        if (to_free->running && to_free->source)
+        if (to_free->source)
         {
-            DEBUG1 ("source shutdown request on \"%s\"", to_free->localmount);
-            to_free->source->running = 0;
-            thread_join (to_free->thread);
-            update_settings = 1;
+            if (to_free->running)
+            {
+                /* relay has been removed from xml, shut down active relay */
+                DEBUG1 ("source shutdown request on \"%s\"", to_free->localmount);
+                to_free->source->running = 0;
+                thread_join (to_free->thread);
+                slave_rebuild_mounts();
+            }
+            else
+                stats_event (to_free->localmount, NULL, NULL);
         }
         to_free = relay_free (to_free);
     }

Modified: icecast/trunk/icecast/src/source.c
===================================================================
--- icecast/trunk/icecast/src/source.c	2005-05-31 02:40:23 UTC (rev 9330)
+++ icecast/trunk/icecast/src/source.c	2005-05-31 02:48:40 UTC (rev 9331)
@@ -432,7 +432,8 @@
         {
             if (source->last_read + (time_t)source->timeout < current)
             {
-                DEBUG3 ("last %ld, timeout %d, now %ld", source->last_read, source->timeout, current);
+                DEBUG3 ("last %ld, timeout %d, now %ld", (long)source->last_read,
+                        source->timeout, (long)current);
                 WARN0 ("Disconnecting source due to socket timeout");
                 source->running = 0;
             }
@@ -707,8 +708,8 @@
         /* update the stats if need be */
         if (source->listeners != listeners)
         {
-            INFO2("listener count on %s now %ld", source->mount, source->listeners);
-            stats_event_args (source->mount, "listeners", "%d", source->listeners);
+            INFO2("listener count on %s now %lu", source->mount, source->listeners);
+            stats_event_args (source->mount, "listeners", "%lu", source->listeners);
         }
 
         /* lets reduce the queue, any lagging clients should of been
@@ -1054,7 +1055,7 @@
     else
     {
         char buf [10];
-        snprintf (buf, sizeof (buf), "%lu", source->max_listeners);
+        snprintf (buf, sizeof (buf), "%ld", source->max_listeners);
         stats_event (source->mount, "max_listeners", buf);
     }
     DEBUG1 ("public set to %d", source->yp_public);

Modified: icecast/trunk/icecast/src/source.h
===================================================================
--- icecast/trunk/icecast/src/source.h	2005-05-31 02:40:23 UTC (rev 9330)
+++ icecast/trunk/icecast/src/source.h	2005-05-31 02:48:40 UTC (rev 9331)
@@ -52,7 +52,6 @@
     unsigned long listeners;
     long max_listeners;
     int yp_public;
-    int yp_prevent;
     struct auth_tag *authenticator;
     int fallback_override;
     int no_mount;

Modified: icecast/trunk/icecast/src/yp.c
===================================================================
--- icecast/trunk/icecast/src/yp.c	2005-05-31 02:40:23 UTC (rev 9330)
+++ icecast/trunk/icecast/src/yp.c	2005-05-31 02:48:40 UTC (rev 9331)
@@ -762,95 +762,51 @@
     if (!info)
         return;
 
+    escaped = util_url_escape(info);
+    if (escaped == NULL)
+        return;
+
     switch (type)
     {
         case YP_SERVER_NAME:
-            escaped = util_url_escape(info);
-            if (escaped)
-            {
-                if (yp->server_name)
-                    free (yp->server_name);
-                yp->server_name = escaped;
-            }
+            free (yp->server_name);
+            yp->server_name = escaped;
             break;
         case YP_SERVER_DESC:
-            escaped = util_url_escape(info);
-            if (escaped)
-            {
-                if (yp->server_desc)
-                    free (yp->server_desc);
-                yp->server_desc = escaped;
-            }
+            free (yp->server_desc);
+            yp->server_desc = escaped;
             break;
         case YP_SERVER_GENRE:
-            escaped = util_url_escape(info);
-            if (escaped)
-            {
-                if (yp->server_genre)
-                    free (yp->server_genre);
-                yp->server_genre = escaped;
-            }
+            free (yp->server_genre);
+            yp->server_genre = escaped;
             break;
         case YP_SERVER_URL:
-            escaped = util_url_escape(info);
-            if (escaped)
-            {
-                if (yp->url)
-                    free (yp->url);
-                yp->url = escaped;
-            }
+            free (yp->url);
+            yp->url = escaped;
             break;
         case YP_BITRATE:
-            escaped = util_url_escape(info);
-            if (escaped)
-            {
-                if (yp->bitrate)
-                    free (yp->bitrate);
-                yp->bitrate = escaped;
-            }
+            free (yp->bitrate);
+            yp->bitrate = escaped;
             break;
         case YP_AUDIO_INFO:
-            escaped = util_url_escape(info);
-            if (escaped)
-            {
-                free (yp->audio_info);
-                yp->audio_info = escaped;
-            }
+            free (yp->audio_info);
+            yp->audio_info = escaped;
             break;
         case YP_SERVER_TYPE:
-            escaped = util_url_escape(info);
-            if (escaped)
-            {
-                if (yp->server_type)
-                    free (yp->server_type);
-                yp->server_type = escaped;
-            }
+            free (yp->server_type);
+            yp->server_type = escaped;
             break;
         case YP_CURRENT_SONG:
-            escaped = util_url_escape(info);
-            if (escaped)
-            {
-                if (yp->current_song)
-                    free (yp->current_song);
-                yp->current_song = escaped;
-            }
+            free (yp->current_song);
+            yp->current_song = escaped;
             break;
         case YP_CLUSTER_PASSWORD:
-            escaped = util_url_escape(info);
-            if (escaped)
-            {
-                if (yp->cluster_password)
-                    free (yp->cluster_password);
-                yp->cluster_password = escaped;
-            }
+            free (yp->cluster_password);
+            yp->cluster_password = escaped;
             break;
         case YP_SUBTYPE:
-            escaped = util_url_escape(info);
-            if (escaped)
-            {
-                free (yp->subtype);
-                yp->subtype = escaped;
-            }
+            free (yp->subtype);
+            yp->subtype = escaped;
             break;
     }
 }



More information about the commits mailing list