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

Karl Heyes karl at xiph.org
Tue Jan 27 17:22:48 PST 2004



karl        04/01/27 20:22:48

  Modified:    src      admin.c
  Log:
  make sure the source doesn't disappear from under us when an admin
  request is performed.

Revision  Changes    Path
1.17      +16 -11    icecast/src/admin.c

Index: admin.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/admin.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- admin.c	15 Jan 2004 01:01:09 -0000	1.16
+++ admin.c	28 Jan 2004 01:22:36 -0000	1.17
@@ -270,19 +270,20 @@
         
         avl_tree_rlock(global.source_tree);
         source = source_find_mount_raw(mount);
-        avl_tree_unlock(global.source_tree);
 
-        if(source == NULL) {
+        if (source == NULL)
+        {
             WARN2("Admin command %s on non-existent source %s", 
                     command_string, mount);
             client_send_400(client, "Source does not exist");
-            return;
         }
-
-        INFO2("Received admin command %s on mount \"%s\"", 
-                command_string, mount);
-
-        admin_handle_mount_request(client, source, command);
+        else
+        {
+            INFO2("Received admin command %s on mount \"%s\"", 
+                    command_string, mount);
+            admin_handle_mount_request(client, source, command);
+        }
+        avl_tree_unlock(global.source_tree);
     }
     else {
 
@@ -448,10 +449,14 @@
         client_destroy(client);
         return;
     }
-    
-    avl_tree_rlock(global.source_tree);
+
+    if (strcmp (dest->mount, source->mount) == 0) 
+    {
+        client_send_400 (client, "supplied mountpoints are identical");
+        return;
+    }
+
     dest = source_find_mount(dest_source);
-    avl_tree_unlock(global.source_tree);
 
     if(dest == NULL) {
         client_send_400(client, "No such source");

<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