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

Jack Moffitt jack at xiph.org
Sun Jan 20 19:10:38 PST 2002



jack        02/01/20 19:10:37

  Modified:    src      connection.c
  Log:
  Fix a stupid but that Oddsock and Ciaran both found.  When sources log in
  we weren't checking to see if the mountpoint was already taken.  Since
  the mountpoint was the key in the avl tree, bad things happened.

Revision  Changes    Path
1.6       +19 -1     icecast/src/connection.c

Index: connection.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/connection.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- connection.c	2001/10/21 02:06:08	1.5
+++ connection.c	2002/01/21 03:10:37	1.6
@@ -345,10 +345,28 @@
                                         continue;
                                 }
 
+				/* check to make sure this source has
+				** a unique mountpoint
+				*/
+
+				avl_tree_rlock(global.source_tree);
+				if (source_find_mount(httpp_getvar(parser, HTTPP_VAR_URI)) != NULL) {
+					printf("Source attempted to connect with an already used mountpoint.\n");
+					INFO1("Source tried to log in as %s, but is already used", httpp_getvar(parser, HTTPP_VAR_URI));
+					connection_close(con);
+					httpp_destroy(parser);
+					avl_tree_unlock(global.source_tree);
+					continue;
+				}
+				avl_tree_unlock(global.source_tree);
+
+				/* check to make sure this source wouldn't
+				** be over the limit
+				*/
                                 global_lock();
                                 if (global.sources >= config_get_config()->source_limit) {
                                         printf("TOO MANY SOURCE, KICKING THIS ONE\n");
-					INFO1("Source (%d) logged in, but there are too many sources", httpp_getvar(parser, HTTPP_VAR_URI));
+					INFO1("Source (%s) logged in, but there are too many sources", httpp_getvar(parser, HTTPP_VAR_URI));
                                         connection_close(con);
                                         httpp_destroy(parser);
                                         global_unlock();

<p><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