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

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Mon May 9 17:28:41 PDT 2005


Author: karl
Date: 2005-05-09 17:28:37 -0700 (Mon, 09 May 2005)
New Revision: 9247

Modified:
   icecast/trunk/icecast/src/fserve.c
   icecast/trunk/icecast/src/fserve.h
   icecast/trunk/icecast/src/util.c
   icecast/trunk/icecast/src/util.h
Log:
removed redundant function, add total files requested to stats


Modified: icecast/trunk/icecast/src/fserve.c
===================================================================
--- icecast/trunk/icecast/src/fserve.c	2005-05-09 21:27:52 UTC (rev 9246)
+++ icecast/trunk/icecast/src/fserve.c	2005-05-10 00:28:37 UTC (rev 9247)
@@ -85,7 +85,7 @@
     char *type;
 } mime_type;
 
-static int _free_client(void *key);
+static void fserve_client_destroy(fserve_t *fclient);
 static int _delete_mapping(void *mapping);
 static void *fserv_thread_function(void *arg);
 static void create_mime_mappings(const char *fn);
@@ -105,6 +105,7 @@
     thread_mutex_create (&pending_lock);
 
     run_fserv = 1;
+    stats_event (NULL, "file_connections", "0");
 
     fserv_thread = thread_create("File Serving Thread", 
             fserv_thread_function, NULL, THREAD_ATTACHED);
@@ -143,7 +144,7 @@
         }
     }
     if (!ufds)
-      thread_sleep(200000);
+        thread_sleep(200000);
     else if (poll(ufds, fserve_clients, 200) > 0)
     {
         /* mark any clients that are ready */
@@ -230,7 +231,7 @@
         }
         /* drop out of here is someone is ready */
         if (fserve_client_waiting())
-           break;
+            break;
     }
 }
 
@@ -260,7 +261,7 @@
                         fserve_t *to_go = fclient;
                         fclient = fclient->next;
                         *trail = fclient;
-                        _free_client (to_go);
+                        fserve_client_destroy (to_go);
                         fserve_clients--;
                         client_tree_changed = 1;
                         continue;
@@ -285,7 +286,7 @@
                     fclient = fclient->next;
                     *trail = fclient;
                     fserve_clients--;
-                    _free_client (to_go);
+                    fserve_client_destroy (to_go);
                     client_tree_changed = 1;
                     continue;
                 }
@@ -302,7 +303,7 @@
         fserve_t *to_go = (fserve_t *)pending_list;
         pending_list = to_go->next;
 
-        _free_client (to_go);
+        fserve_client_destroy (to_go);
     }
     thread_mutex_unlock (&pending_lock);
 
@@ -310,13 +311,13 @@
     {
         fserve_t *to_go = active_list;
         active_list = to_go->next;
-        _free_client (to_go);
+        fserve_client_destroy (to_go);
     }
 
     return NULL;
 }
 
-static const char *fserve_content_type(char *path)
+static const char *fserve_content_type(const char *path)
 {
     char *ext = util_get_extension(path);
     mime_type exttype = {ext, NULL};
@@ -358,7 +359,8 @@
     }
 }
 
-int fserve_client_create(client_t *httpclient, char *path)
+
+int fserve_client_create(client_t *httpclient, const char *path)
 {
     fserve_t *client = calloc(1, sizeof(fserve_t));
     int bytes;
@@ -474,6 +476,7 @@
         if(bytes > 0) httpclient->con->sent_bytes = bytes;
     }
 
+    stats_event_inc (NULL, "file_connections");
     sock_set_blocking(client->client->con->sock, SOCK_NONBLOCK);
     sock_set_nodelay(client->client->con->sock);
 
@@ -485,15 +488,7 @@
     return 0;
 }
 
-static int _free_client(void *key)
-{
-    fserve_t *client = (fserve_t *)key;
 
-    fserve_client_destroy(client);
-    
-    return 1;
-}
-
 static int _delete_mapping(void *mapping) {
     mime_type *map = mapping;
     free(map->ext);

Modified: icecast/trunk/icecast/src/fserve.h
===================================================================
--- icecast/trunk/icecast/src/fserve.h	2005-05-09 21:27:52 UTC (rev 9246)
+++ icecast/trunk/icecast/src/fserve.h	2005-05-10 00:28:37 UTC (rev 9247)
@@ -31,7 +31,7 @@
 
 void fserve_initialize(void);
 void fserve_shutdown(void);
-int fserve_client_create(client_t *httpclient, char *path);
+int fserve_client_create(client_t *httpclient, const char *path);
 
 
 #endif

Modified: icecast/trunk/icecast/src/util.c
===================================================================
--- icecast/trunk/icecast/src/util.c	2005-05-09 21:27:52 UTC (rev 9246)
+++ icecast/trunk/icecast/src/util.c	2005-05-10 00:28:37 UTC (rev 9247)
@@ -131,7 +131,7 @@
     return ret;
 }
 
-char *util_get_extension(char *path) {
+char *util_get_extension(const char *path) {
     char *ext = strrchr(path, '.');
 
     if(ext == NULL)
@@ -225,7 +225,7 @@
     }
 }
 
-char *util_get_path_from_normalised_uri(char *uri) {
+char *util_get_path_from_normalised_uri(const char *uri) {
     char *fullpath;
     char *webroot;
     ice_config_t *config = config_get_config();

Modified: icecast/trunk/icecast/src/util.h
===================================================================
--- icecast/trunk/icecast/src/util.h	2005-05-09 21:27:52 UTC (rev 9246)
+++ icecast/trunk/icecast/src/util.h	2005-05-10 00:28:37 UTC (rev 9247)
@@ -22,9 +22,9 @@
 int util_timed_wait_for_fd(int fd, int timeout);
 int util_read_header(int sock, char *buff, unsigned long len, int entire);
 int util_check_valid_extension(char *uri);
-char *util_get_extension(char *path);
+char *util_get_extension(const char *path);
 char *util_get_path_from_uri(char *uri);
-char *util_get_path_from_normalised_uri(char *uri);
+char *util_get_path_from_normalised_uri(const char *uri);
 char *util_normalise_uri(char *uri);
 char *util_base64_encode(char *data);
 char *util_base64_decode(unsigned char *input);



More information about the commits mailing list