[xiph-commits] r9634 - in icecast/branches/kh/icecast: . src

karl at svn.xiph.org karl at svn.xiph.org
Thu Jul 28 06:19:33 PDT 2005


Author: karl
Date: 2005-07-28 06:19:25 -0700 (Thu, 28 Jul 2005)
New Revision: 9634

Modified:
   icecast/branches/kh/icecast/configure.in
   icecast/branches/kh/icecast/src/admin.c
   icecast/branches/kh/icecast/src/auth.c
   icecast/branches/kh/icecast/src/auth.h
   icecast/branches/kh/icecast/src/cfgfile.c
   icecast/branches/kh/icecast/src/client.c
   icecast/branches/kh/icecast/src/client.h
   icecast/branches/kh/icecast/src/connection.c
   icecast/branches/kh/icecast/src/fserve.c
   icecast/branches/kh/icecast/src/fserve.h
   icecast/branches/kh/icecast/src/global.h
   icecast/branches/kh/icecast/src/logging.h
   icecast/branches/kh/icecast/src/source.c
   icecast/branches/kh/icecast/src/source.h
   icecast/branches/kh/icecast/src/stats.c
   icecast/branches/kh/icecast/src/stats.h
Log:
various fixes/updates collected. send http response codes via the client
buffer to the fserve engine, using a callback for 200 OK.  Create a client_t
even on reaching the client limit as that allows for sending response via
fserve, should help with SSL migration work later


Modified: icecast/branches/kh/icecast/configure.in
===================================================================
--- icecast/branches/kh/icecast/configure.in	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/configure.in	2005-07-28 13:19:25 UTC (rev 9634)
@@ -116,7 +116,7 @@
         ], [ AC_MSG_NOTICE([Your curl dev files are too old (7.10 or above required), YP disabled])
         ], [#include <curl/curl.h>
         ])
-    ],[ AC_MSG_NOTICE([libcurl not found, YP disabled])
+    ],[ AC_MSG_NOTICE([libcurl not found])
     ])
 dnl -- YP support --
 AC_ARG_ENABLE([yp],

Modified: icecast/branches/kh/icecast/src/admin.c
===================================================================
--- icecast/branches/kh/icecast/src/admin.c	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/admin.c	2005-07-28 13:19:25 UTC (rev 9634)
@@ -571,12 +571,12 @@
     int bytes;
 
     client->respcode = 200;
-    bytes = sock_write(client->con->sock, 
+    bytes = snprintf (client->refbuf->data, client->refbuf->len,
             "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n" 
             "<html><head><title>Admin request successful</title></head>"
             "<body><p>%s</p></body></html>", message);
-    if(bytes > 0) client->con->sent_bytes = bytes;
-    client_destroy(client);
+    client->refbuf->len = bytes;
+    fserve_add_client (client, NULL);
 }
 
 
@@ -832,33 +832,29 @@
 {
     char *username = NULL;
     char *password = NULL;
-    char *host = NULL;
-    int port = 0;
+    int bytes;
     ice_config_t *config;
 
     COMMAND_REQUIRE(client, "username", username);
     COMMAND_REQUIRE(client, "password", password);
 
-    config = config_get_config();
-    host = strdup(config->hostname);
-    port = config->port;
-    config_release_config();
-
     client->respcode = 200;
-    sock_write(client->con->sock,
+    config = config_get_config();
+    bytes = snprintf (client->refbuf->data, client->refbuf->len,
         "HTTP/1.0 200 OK\r\n"
         "Content-Type: audio/x-mpegurl\r\n"
         "Content-Disposition = attachment; filename=listen.m3u\r\n\r\n" 
         "http://%s:%s@%s:%d%s\r\n",
         username,
         password,
-        host,
-        port,
+        config->hostname,
+        config->port,
         source->mount
     );
+    config_release_config();
 
-    free(host);
-    client_destroy(client);
+    client->refbuf->len = strlen (client->refbuf->data);
+    fserve_add_client (client, NULL);
 }
 
 

Modified: icecast/branches/kh/icecast/src/auth.c
===================================================================
--- icecast/branches/kh/icecast/src/auth.c	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/auth.c	2005-07-28 13:19:25 UTC (rev 9634)
@@ -339,7 +339,7 @@
     config_release_config();
 
     if (ret < 0)
-        client_send_504 (auth_user->client, "stream full");
+        client_send_401 (auth_user->client);
     auth_user->client = NULL;
 
     return ret;

Modified: icecast/branches/kh/icecast/src/auth.h
===================================================================
--- icecast/branches/kh/icecast/src/auth.h	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/auth.h	2005-07-28 13:19:25 UTC (rev 9634)
@@ -64,7 +64,6 @@
     auth_result (*adduser)(struct auth_tag *auth, const char *username, const char *password);
     auth_result (*deleteuser)(struct auth_tag *auth, const char *username);
     auth_result (*listuser)(struct auth_tag *auth, xmlNodePtr srcnode);
-    int (*checkuser)(struct source_tag *source, client_t *client);
 
     int refcount;
     int allow_duplicate_users;

Modified: icecast/branches/kh/icecast/src/cfgfile.c
===================================================================
--- icecast/branches/kh/icecast/src/cfgfile.c	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/cfgfile.c	2005-07-28 13:19:25 UTC (rev 9634)
@@ -776,6 +776,8 @@
         }
     }
 
+    if (listener == NULL)
+        return;
     do {
         if (node == NULL) break;
         if (xmlIsBlankNode(node)) continue;

Modified: icecast/branches/kh/icecast/src/client.c
===================================================================
--- icecast/branches/kh/icecast/src/client.c	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/client.c	2005-07-28 13:19:25 UTC (rev 9634)
@@ -32,6 +32,7 @@
 #include "refbuf.h"
 #include "format.h"
 #include "stats.h"
+#include "fserve.h"
 
 #include "client.h"
 #include "logging.h"
@@ -43,33 +44,35 @@
 #include <errno.h>
 #endif
 
-client_t *client_create(connection_t *con, http_parser_t *parser)
+/* should be called with global lock held */
+int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser)
 {
-    ice_config_t *config = config_get_config ();
+    ice_config_t *config;
     client_t *client = (client_t *)calloc(1, sizeof(client_t));
-    int client_limit = config->client_limit;
+    int ret = -1;
+
+    if (client == NULL)
+        return -1;
+
+    config = config_get_config ();
+
+    global.clients++;
+    if (config->client_limit < global.clients)
+        WARN2 ("server client limit reached (%d/%d)", config->client_limit, global.clients);
+    else
+        ret = 0;
+
     config_release_config ();
 
-    global_lock();
-    if (global.clients >= client_limit || client == NULL)
-    {
-        client_limit = global.clients;
-        global_unlock();
-        free (client);
-        WARN1 ("server client limit reached (%d clients)", client_limit);
-        return NULL;
-    }
-    global.clients++;
     stats_event_args (NULL, "clients", "%d", global.clients);
-    global_unlock();
-
     client->con = con;
     client->parser = parser;
-    client->refbuf = NULL;
+    client->refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
     client->pos = 0;
     client->write_to_client = format_generic_write_to_client;
+    *c_ptr = client;
 
-    return client;
+    return ret;
 }
 
 void client_destroy(client_t *client)
@@ -83,7 +86,7 @@
     /* write log entry if ip is set (some things don't set it, like outgoing 
      * slave requests
      */
-    if (client->respcode)
+    if (client->respcode && client->parser)
         logging_access(client);
 
 #ifdef HAVE_AIO
@@ -158,60 +161,61 @@
 
 
 void client_send_302(client_t *client, char *location) {
-    int bytes;
-    bytes = sock_write(client->con->sock, "HTTP/1.0 302 Temporarily Moved\r\n"
+    snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
+            "HTTP/1.0 302 Temporarily Moved\r\n"
             "Content-Type: text/html\r\n"
             "Location: %s\r\n\r\n"
             "<a href=\"%s\">%s</a>", location, location, location);
-    if(bytes > 0) client->con->sent_bytes = bytes;
     client->respcode = 302;
-    client_destroy(client);
+    client->refbuf->len = strlen (client->refbuf->data);
+    fserve_add_client (client, NULL);
 }
 
 
 void client_send_400(client_t *client, char *message) {
-    int bytes;
-    bytes = sock_write(client->con->sock, "HTTP/1.0 400 Bad Request\r\n"
+    snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
+            "HTTP/1.0 400 Bad Request\r\n"
             "Content-Type: text/html\r\n\r\n"
             "<b>%s</b>\r\n", message);
-    if(bytes > 0) client->con->sent_bytes = bytes;
     client->respcode = 400;
-    client_destroy(client);
+    client->refbuf->len = strlen (client->refbuf->data);
+    fserve_add_client (client, NULL);
 }
 
 void client_send_404(client_t *client, char *message) {
 
-    int bytes;
-    bytes = sock_write(client->con->sock, "HTTP/1.0 404 File Not Found\r\n"
+    snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
+            "HTTP/1.0 404 File Not Found\r\n"
             "Content-Type: text/html\r\n\r\n"
             "<b>%s</b>\r\n", message);
     client->respcode = 404;
-    client_destroy(client);
+    client->refbuf->len = strlen (client->refbuf->data);
+    fserve_add_client (client, NULL);
 }
 
-void client_send_504(client_t *client, char *message) {
-    int bytes;
-    client->respcode = 504;
-    bytes = sock_write(client->con->sock, 
-            "HTTP/1.0 504 Server Full\r\n"
-            "Content-Type: text/html\r\n\r\n"
-            "<b>%s</b>\r\n", message);
-       if (bytes > 0) client->con->sent_bytes = bytes;
-    client_destroy(client);
-}
 
 void client_send_401(client_t *client) {
-    int bytes = sock_write(client->con->sock, 
+    snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
             "HTTP/1.0 401 Authentication Required\r\n"
             "WWW-Authenticate: Basic realm=\"Icecast2 Server\"\r\n"
             "\r\n"
             "You need to authenticate\r\n");
-    if(bytes > 0) client->con->sent_bytes = bytes;
     client->respcode = 401;
-    client_destroy(client);
+    client->refbuf->len = strlen (client->refbuf->data);
+    fserve_add_client (client, NULL);
 }
 
 
+void client_send_416(client_t *client)
+{
+    snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
+            "HTTP/1.0 416 Request Range Not Satisfiable\r\n\r\n");
+    client->respcode = 416;
+    client->refbuf->len = strlen (client->refbuf->data);
+    fserve_add_client (client, NULL);
+}
+
+
 /* helper function for sending the data to a client */
 int client_send_bytes (client_t *client, const void *buf, unsigned len)
 {

Modified: icecast/branches/kh/icecast/src/client.h
===================================================================
--- icecast/branches/kh/icecast/src/client.h	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/client.h	2005-07-28 13:19:25 UTC (rev 9634)
@@ -83,9 +83,10 @@
     struct _client_tag *next;
 } client_t;
 
-client_t *client_create(connection_t *con, http_parser_t *parser);
+int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser);
 void client_destroy(client_t *client);
 void client_send_504(client_t *client, char *message);
+void client_send_416(client_t *client);
 void client_send_404(client_t *client, char *message);
 void client_send_401(client_t *client);
 void client_send_400(client_t *client, char *message);

Modified: icecast/branches/kh/icecast/src/connection.c
===================================================================
--- icecast/branches/kh/icecast/src/connection.c	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/connection.c	2005-07-28 13:19:25 UTC (rev 9634)
@@ -421,19 +421,18 @@
             client_queue_t *node;
             ice_config_t *config;
             int i;
-            client_t *client = client_create (con, NULL);
+            client_t *client = NULL;
 
-            if (client == NULL)
+            global_lock();
+            if (client_create (&client, con, NULL) < 0)
             {
-                sock_write (con->sock, "HTTP/1.0 404 File Not Found\r\n"
-                        "Content-Type: text/html\r\n\r\n"
-                        "<b>Icecast connection limit reached</b>");
-                connection_close (con);
+                global_unlock();
+                client_send_404 (client, "Icecast connection limit reached");
                 continue;
             }
+            global_unlock();
 
             /* setup client for reading incoming http */
-            client->refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
             client->refbuf->data [PER_CLIENT_REFBUF_SIZE-1] = '\000';
             client->refbuf->len--;  /* make sure we are nul terminated */
 
@@ -530,10 +529,6 @@
             return -1;
         }
 
-        global.sources++;
-        stats_event_args (NULL, "sources", "%d", global.sources);
-        global_unlock();
-
         /* 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,
          * because we can't use this client to return an error code/message,
@@ -541,18 +536,16 @@
          */
         if (source->client == NULL)
         {
-            source->client = client_create (con, parser);
-            if (source->client == NULL)
+            if (client_create (&source->client, con, parser) < 0)
             {
                 config_release_config();
-                global_lock();
-                global.sources--;
                 global_unlock();
-                connection_close (con);
-                httpp_destroy (parser);
                 return -1;
             }
         }
+        global.sources++;
+        stats_event_args (NULL, "sources", "%d", global.sources);
+        global_unlock();
 
         source->running = 1;
         mountinfo = config_find_mount (config, source->mount);
@@ -765,8 +758,13 @@
             source_free_source (source);
         }
         else
-            thread_create ("Source Thread", source_client_thread,
-                    source, THREAD_DETACHED);
+        {
+            client->respcode = 200;
+            snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
+                    "HTTP/1.0 200 OK\r\n\r\n");
+            client->refbuf->len = strlen (client->refbuf->data);
+            fserve_add_client_callback (client, source_client_callback, source);
+        }
     }
     else
     {
@@ -788,14 +786,10 @@
     }
 
     client->respcode = 200;
-    if (sock_write (client->con->sock, "HTTP/1.0 200 OK\r\n\r\n") < 19)
-    {
-        client_destroy (client);
-        ERROR0 ("failed to write header");
-        return;
-    }
-
-    thread_create("Stats Connection", stats_connection, (void *)client, THREAD_DETACHED);
+    snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
+            "HTTP/1.0 200 OK\r\n\r\n");
+    client->refbuf->len = strlen (client->refbuf->data);
+    fserve_add_client_callback (client, stats_callback, NULL);
 }
 
 static void _handle_get_request (client_t *client, char *passed_uri)

Modified: icecast/branches/kh/icecast/src/fserve.c
===================================================================
--- icecast/branches/kh/icecast/src/fserve.c	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/fserve.c	2005-07-28 13:19:25 UTC (rev 9634)
@@ -360,8 +360,11 @@
         if (fclient->file)
             fclose (fclient->file);
 
-        if (fclient->client)
-            client_destroy (fclient->client);
+        if (fclient->callback)
+            fclient->callback (fclient->client, fclient->arg);
+        else
+            if (fclient->client)
+                client_destroy (fclient->client);
         free (fclient);
     }
 }
@@ -533,10 +536,7 @@
     } while (0);
     /* If we run into any issues with the ranges
        we fallback to a normal/non-range request */
-    httpclient->respcode = 416;
-    sock_write (httpclient->con->sock,
-            "HTTP/1.0 416 Request Range Not Satisfiable\r\n\r\n");
-    client_destroy (httpclient);
+    client_send_416 (httpclient);
     return 0;
 }
 
@@ -567,6 +567,32 @@
 }
 
 
+/* add client to file serving engine, but just write out the buffer contents,
+ * then pass the client to the callback with the provided arg
+ */
+void fserve_add_client_callback (client_t *client, fserve_callback_t callback, void *arg)
+{
+    fserve_t *fclient = calloc (1, sizeof(fserve_t));
+
+    DEBUG0 ("Adding client to file serving engine");
+    if (fclient == NULL)
+    {
+        client_send_404 (client, "memory exhausted");
+        return;
+    }
+    fclient->file = NULL;
+    fclient->client = client;
+    fclient->ready = 0;
+    fclient->callback = callback;
+    fclient->arg = arg;
+
+    thread_mutex_lock (&pending_lock);
+    fclient->next = (fserve_t *)pending_list;
+    pending_list = fclient;
+    thread_mutex_unlock (&pending_lock);
+}
+
+
 static int _delete_mapping(void *mapping) {
     mime_type *map = mapping;
     free(map->ext);

Modified: icecast/branches/kh/icecast/src/fserve.h
===================================================================
--- icecast/branches/kh/icecast/src/fserve.h	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/fserve.h	2005-07-28 13:19:25 UTC (rev 9634)
@@ -15,12 +15,16 @@
 
 #include <stdio.h>
 
+typedef void (*fserve_callback_t)(client_t *, void *);
+
 typedef struct _fserve_t
 {
     client_t *client;
 
     FILE *file;
     int ready;
+    void (*callback)(client_t *, void *);
+    void *arg;
     struct _fserve_t *next;
 } fserve_t;
 
@@ -28,6 +32,7 @@
 void fserve_shutdown(void);
 int fserve_client_create(client_t *httpclient, const char *path);
 int fserve_add_client (client_t *client, FILE *file);
+void fserve_add_client_callback (client_t *client, fserve_callback_t callback, void *arg);
 const char *fserve_content_type (const char *path);
 
 

Modified: icecast/branches/kh/icecast/src/global.h
===================================================================
--- icecast/branches/kh/icecast/src/global.h	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/global.h	2005-07-28 13:19:25 UTC (rev 9634)
@@ -20,7 +20,7 @@
 
 #define ICECAST_VERSION_STRING "Icecast " PACKAGE_VERSION
 
-#define MAX_LISTEN_SOCKETS 10
+#define MAX_LISTEN_SOCKETS 50
 
 #include "thread/thread.h"
 #include "slave.h"

Modified: icecast/branches/kh/icecast/src/logging.h
===================================================================
--- icecast/branches/kh/icecast/src/logging.h	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/logging.h	2005-07-28 13:19:25 UTC (rev 9634)
@@ -33,6 +33,10 @@
 #define __FUNCTION__ strrchr (__FILE__, '\\') ? strrchr (__FILE__, '\\') + 1 : __FILE__
 #endif
 
+#ifdef __SUNPRO_C
+#define __FUNCTION__ __func__
+#endif
+
 #define ERROR0(y) log_write(errorlog, 1, CATMODULE "/", __FUNCTION__, y)
 #define ERROR1(y, a) log_write(errorlog, 1, CATMODULE "/", __FUNCTION__, y, a)
 #define ERROR2(y, a, b) log_write(errorlog, 1, CATMODULE "/", __FUNCTION__, y, a, b)

Modified: icecast/branches/kh/icecast/src/source.c
===================================================================
--- icecast/branches/kh/icecast/src/source.c	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/source.c	2005-07-28 13:19:25 UTC (rev 9634)
@@ -1130,7 +1130,7 @@
     source->queue_size_limit = config->queue_size_limit;
     source->timeout = config->source_timeout;
     source->burst_size = config->burst_size;
-    
+
     source_apply_mount (source, mountinfo);
 
     if (source->fallback_mount)
@@ -1181,28 +1181,6 @@
 {
     source_t *source = arg;
 
-    if (source->client && source->client->con)
-    {
-        const char ok_msg[] = "HTTP/1.0 200 OK\r\n\r\n";
-        int bytes ;
-        const char *agent;
-
-        source->client->respcode = 200;
-        bytes = sock_write_bytes (source->client->con->sock, ok_msg, sizeof (ok_msg)-1);
-        if (bytes < (int)(sizeof (ok_msg)-1))
-        {
-            global_lock();
-            global.sources--;
-            global_unlock();
-            WARN0 ("Error writing 200 OK message to source client");
-            source_free_source (source);
-            return NULL;
-        }
-        stats_event (source->mount, "source_ip", source->client->con->ip);
-        agent = httpp_getvar (source->client->parser, "user-agent");
-        if (agent)
-            stats_event (source->mount, "user_agent", agent);
-    }
     stats_event_inc(NULL, "source_client_connections");
     stats_event (source->mount, "listeners", "0");
 
@@ -1215,6 +1193,30 @@
 }
 
 
+void source_client_callback (client_t *client, void *arg)
+{
+    const char *agent;
+    source_t *source = arg;
+
+    if (client->con->error)
+    {
+        global_lock();
+        global.sources--;
+        global_unlock();
+        source_free_source (source);
+        client_destroy (client);
+        return;
+    }
+    stats_event (source->mount, "source_ip", source->client->con->ip);
+    agent = httpp_getvar (source->client->parser, "user-agent");
+    if (agent)
+        stats_event (source->mount, "user_agent", agent);
+
+    thread_create ("Source Thread", source_client_thread,
+            source, THREAD_DETACHED);
+}
+
+
 #ifndef _WIN32
 static void source_run_script (char *command, char *mountpoint)
 {

Modified: icecast/branches/kh/icecast/src/source.h
===================================================================
--- icecast/branches/kh/icecast/src/source.h	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/source.h	2005-07-28 13:19:25 UTC (rev 9634)
@@ -83,6 +83,7 @@
 
 source_t *source_reserve (const char *mount);
 void *source_client_thread (void *arg);
+void source_client_callback (client_t *client, void *source);
 void source_update_settings (ice_config_t *config, source_t *source, mount_proxy *mountinfo);
 void source_clear_source (source_t *source);
 source_t *source_find_mount(const char *mount);

Modified: icecast/branches/kh/icecast/src/stats.c
===================================================================
--- icecast/branches/kh/icecast/src/stats.c	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/stats.c	2005-07-28 13:19:25 UTC (rev 9634)
@@ -844,6 +844,19 @@
     return NULL;
 }
 
+
+void stats_callback (client_t *client, void *notused)
+{
+    if (client->con->error)
+    {
+        client_destroy (client);
+        return;
+    }
+    client_set_queue (client, NULL);
+    thread_create("Stats Connection", stats_connection, (void *)client, THREAD_DETACHED);
+}
+
+
 typedef struct _source_xml_tag {
     char *mount;
     xmlNodePtr node;
@@ -962,62 +975,8 @@
         src_nodes = next;
     }
 }
-void stats_sendxml(client_t *client)
-{
-    int bytes;
-    stats_event_t *event;
-    stats_event_t *queue;
-    xmlDocPtr doc;
-    xmlNodePtr node, srcnode;
-    int len;
-    xmlChar *buff = NULL;
-    source_xml_t *snd;
-    source_xml_t *src_nodes = NULL;
 
-    queue = NULL;
-    _dump_stats_to_queue(&queue);
 
-    doc = xmlNewDoc("1.0");
-    node = xmlNewDocNode(doc, NULL, "icestats", NULL);
-    xmlDocSetRootElement(doc, node);
-
-
-    event = _get_event_from_queue(&queue);
-    while (event) {
-        if (event->source == NULL) {
-            xmlNewChild(node, NULL, event->name, event->value);
-        } else {
-            srcnode = _find_xml_node(event->source, &src_nodes, node);
-            xmlNewChild(srcnode, NULL, event->name, event->value);
-        }
-
-        _free_event(event);
-        event = _get_event_from_queue(&queue);
-    }
-
-    xmlDocDumpMemory(doc, &buff, &len);
-    xmlFreeDoc(doc);
-    
-    client->respcode = 200;
-    bytes = sock_write(client->con->sock, "HTTP/1.0 200 OK\r\n"
-               "Content-Length: %d\r\n"
-               "Content-Type: text/xml\r\n"
-               "\r\n", len);
-    if (bytes > 0) client->con->sent_bytes += bytes;
-    else goto send_error;
-
-    bytes = client_send_bytes (client, buff, (unsigned)len);
-
- send_error:
-    while (src_nodes) {
-        snd = src_nodes->next;
-        free(src_nodes->mount);
-        free(src_nodes);
-        src_nodes = snd;
-    }
-    if (buff) xmlFree(buff);
-}
-
 static int _compare_stats(void *arg, void *a, void *b)
 {
     stats_node_t *nodea = (stats_node_t *)a;

Modified: icecast/branches/kh/icecast/src/stats.h
===================================================================
--- icecast/branches/kh/icecast/src/stats.h	2005-07-28 04:39:35 UTC (rev 9633)
+++ icecast/branches/kh/icecast/src/stats.h	2005-07-28 13:19:25 UTC (rev 9634)
@@ -84,7 +84,7 @@
 void stats_event_time (const char *mount, const char *name);
 
 void *stats_connection(void *arg);
-void *stats_callback(void *arg);
+void stats_callback (client_t *client, void *notused);
 
 void stats_transform_xslt(client_t *client, const char *uri);
 void stats_sendxml(client_t *client);



More information about the commits mailing list