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

Karl Heyes karl at xiph.org
Fri Feb 20 09:42:58 PST 2004



karl        04/02/20 12:42:58

  Modified:    src      admin.c connection.c slave.c source.c
  Log:
  Add accumulative stats back for source connections and don't hold locks
  while writing responses back to the client.

Revision  Changes    Path
1.24      +2 -1      icecast/src/admin.c

Index: admin.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/admin.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- admin.c	19 Feb 2004 15:24:06 -0000	1.23
+++ admin.c	20 Feb 2004 17:42:57 -0000	1.24
@@ -285,6 +285,7 @@
         {
             WARN2("Admin command %s on non-existent source %s", 
                     command_string, mount);
+            avl_tree_unlock(global.source_tree);
             client_send_400(client, "Source does not exist");
         }
         else
@@ -300,8 +301,8 @@
             INFO2("Received admin command %s on mount \"%s\"", 
                     command_string, mount);
             admin_handle_mount_request(client, source, command);
+            avl_tree_unlock(global.source_tree);
         }
-        avl_tree_unlock(global.source_tree);
     }
     else {
 

<p><p>1.89      +8 -8      icecast/src/connection.c

Index: connection.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/connection.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- connection.c	19 Feb 2004 21:16:59 -0000	1.88
+++ connection.c	20 Feb 2004 17:42:57 -0000	1.89
@@ -480,6 +480,7 @@
         global.sources++;
         global_unlock();
         stats_event_inc(NULL, "sources");
+        stats_event_inc(NULL, "source_total_connections");
 
         /* for relays, we don't yet have a client, however we do require one
          * to retrieve the stream from.  This is created here, quite late,
@@ -679,7 +680,6 @@
     client = client_create(con, parser);
 
     INFO1("Source logging in at mountpoint \"%s\"", uri);
-    stats_event_inc(NULL, "source_connections");
                 
     if (!connection_check_source_pass(parser, uri)) {
         /* We commonly get this if the source client is using the wrong
@@ -885,9 +885,9 @@
 
     global_lock();
     if (global.clients >= client_limit) {
-        client_send_504(client,
-                "The server is already full. Try again later.");
         global_unlock();
+        client_send_404(client,
+                "The server is already full. Try again later.");
         return;
     }
     global_unlock();
@@ -902,8 +902,8 @@
          * the originally requested source
          */
         if(strcmp(uri, source->mount) == 0 && source->no_mount) {
-            client_send_404(client, "This mount is unavailable.");
             avl_tree_unlock(global.source_tree);
+            client_send_404(client, "This mount is unavailable.");
             return;
         }
         if (source->running == 0)
@@ -928,10 +928,10 @@
         /* And then check that there's actually room in the server... */
         global_lock();
         if (global.clients >= client_limit) {
-            client_send_504(client, 
-                    "The server is already full. Try again later.");
             global_unlock();
             avl_tree_unlock(global.source_tree);
+            client_send_404(client, 
+                    "The server is already full. Try again later.");
             return;
         }
         /* Early-out for per-source max listeners. This gets checked again
@@ -941,10 +941,10 @@
         else if(source->max_listeners != -1 && 
                 source->listeners >= source->max_listeners) 
         {
-            client_send_504(client, 
-                    "Too many clients on this mountpoint. Try again later.");
             global_unlock();
             avl_tree_unlock(global.source_tree);
+            client_send_404(client, 
+                    "Too many clients on this mountpoint. Try again later.");
             return;
         }
         global.clients++;

<p><p>1.34      +1 -0      icecast/src/slave.c

Index: slave.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/slave.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- slave.c	19 Feb 2004 20:28:21 -0000	1.33
+++ slave.c	20 Feb 2004 17:42:57 -0000	1.34
@@ -99,6 +99,7 @@
     relay_server *relay = arg;
 
     relay->running = 1;
+    stats_event_inc(NULL, "source_relay_connections");
 
     source_main (relay->source);
 

<p><p>1.75      +1 -0      icecast/src/source.c

Index: source.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/source.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- source.c	19 Feb 2004 21:16:59 -0000	1.74
+++ source.c	20 Feb 2004 17:42:57 -0000	1.75
@@ -915,6 +915,7 @@
     source_t *source = arg;
 
     source->send_return = 1;
+    stats_event_inc(NULL, "source_client_connections");
     source_main (source);
     source_free_source (source);
     return NULL;

<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