[xiph-commits] r9997 - icecast/branches/kh/icecast/src

karl at svn.xiph.org karl at svn.xiph.org
Wed Sep 7 15:44:35 PDT 2005


Author: karl
Date: 2005-09-07 15:44:30 -0700 (Wed, 07 Sep 2005)
New Revision: 9997

Modified:
   icecast/branches/kh/icecast/src/auth.c
   icecast/branches/kh/icecast/src/connection.c
   icecast/branches/kh/icecast/src/fserve.c
   icecast/branches/kh/icecast/src/slave.c
   icecast/branches/kh/icecast/src/source.c
   icecast/branches/kh/icecast/src/stats.c
Log:
small fixes, mostly logging, some lock updates


Modified: icecast/branches/kh/icecast/src/auth.c
===================================================================
--- icecast/branches/kh/icecast/src/auth.c	2005-09-07 20:11:04 UTC (rev 9996)
+++ icecast/branches/kh/icecast/src/auth.c	2005-09-07 22:44:30 UTC (rev 9997)
@@ -537,7 +537,7 @@
     }
     auth->type = xmlGetProp (node, "type");
     get_authenticator (auth, options);
-    thread_mutex_create (&auth->lock);
+    thread_mutex_create ("auth_t", &auth->lock);
     while (options)
     {
         config_options_t *opt = options;

Modified: icecast/branches/kh/icecast/src/connection.c
===================================================================
--- icecast/branches/kh/icecast/src/connection.c	2005-09-07 20:11:04 UTC (rev 9996)
+++ icecast/branches/kh/icecast/src/connection.c	2005-09-07 22:44:30 UTC (rev 9997)
@@ -558,6 +558,8 @@
             {
                 global_unlock();
                 client_send_404 (client, "Icecast connection limit reached");
+                /* don't be too eager as this is an imposed hard limit */
+                thread_sleep (400000);
                 continue;
             }
             global_unlock();
@@ -881,6 +883,7 @@
         source->client = client;
         if (connection_complete_source (source, NULL, 1) < 0)
         {
+            source_clear_source (source);
             source_free_source (source);
         }
         else

Modified: icecast/branches/kh/icecast/src/fserve.c
===================================================================
--- icecast/branches/kh/icecast/src/fserve.c	2005-09-07 20:11:04 UTC (rev 9996)
+++ icecast/branches/kh/icecast/src/fserve.c	2005-09-07 22:44:30 UTC (rev 9997)
@@ -415,8 +415,13 @@
         char *protocol = "http";
         char *agent = httpp_getvar (httpclient->parser, "user-agent");
 
-        if (agent && (strstr (agent, "QTS") || strstr (agent, "QuickTime")))
-            protocol = "icy";
+        if (agent)
+        {
+            if (strstr (agent, "QTS") || strstr (agent, "QuickTime"))
+                protocol = "icy";
+            if (strchr (agent, ':') == NULL)
+                host = NULL;
+        }
 
         *dot = 0;
         httpclient->respcode = 200;

Modified: icecast/branches/kh/icecast/src/slave.c
===================================================================
--- icecast/branches/kh/icecast/src/slave.c	2005-09-07 20:11:04 UTC (rev 9996)
+++ icecast/branches/kh/icecast/src/slave.c	2005-09-07 22:44:30 UTC (rev 9997)
@@ -310,13 +310,16 @@
             break;
         }
 
+        global_lock ();
         if (client_create (&src->client, con, parser) < 0)
         {
+            global_unlock ();
             /* make sure only the client_destory frees these */
             con = NULL;
             parser = NULL;
             break;
         }
+        global_unlock ();
         con = NULL;
         parser = NULL;
         client_set_queue (src->client, NULL);
@@ -642,7 +645,7 @@
     /* append newly read data to the end of any previous unprocess data */
     buffer = realloc (master->buffer, len);
     memcpy (buffer + master->previous, ptr, passed_len);
-    buffer [len] = '\0';
+    buffer [len-1] = '\0';
 
     buf = buffer;
     while (len)

Modified: icecast/branches/kh/icecast/src/source.c
===================================================================
--- icecast/branches/kh/icecast/src/source.c	2005-09-07 20:11:04 UTC (rev 9996)
+++ icecast/branches/kh/icecast/src/source.c	2005-09-07 22:44:30 UTC (rev 9997)
@@ -189,6 +189,8 @@
 
 void source_clear_source (source_t *source)
 {
+    int i;
+
     DEBUG1 ("clearing source \"%s\"", source->mount);
     client_destroy(source->client);
     source->client = NULL;
@@ -201,13 +203,16 @@
     }
 
     /* lets drop any clients still connected */
+    i = 0;
     while (source->active_clients)
     {
         client_t *client = source->active_clients;
         source->active_clients = client->next;
         source_free_client (source, client);
+        i++;
     }
     source->fast_clients_p = &source->active_clients;
+    DEBUG1 ("removed %d listeners", i);
 
     format_free_plugin (source->format);
     source->format = NULL;

Modified: icecast/branches/kh/icecast/src/stats.c
===================================================================
--- icecast/branches/kh/icecast/src/stats.c	2005-09-07 20:11:04 UTC (rev 9996)
+++ icecast/branches/kh/icecast/src/stats.c	2005-09-07 22:44:30 UTC (rev 9997)
@@ -429,7 +429,7 @@
         str = (char *)strdup (event->value);
     free (node->value);
     node->value = str;
-    /* DEBUG2 ("update node %s (%s)", node->name, node->value); */
+    DEBUG2 ("update node %s (%s)", node->name, node->value);
 }
 
 



More information about the commits mailing list