[icecast-dev] improved error.log output --diff

John covici covici at ccs.covici.com
Thu Aug 7 05:51:08 PDT 2003



diff -u --recursive icecast/src/admin.c icecast-new/src/admin.c
--- icecast/src/admin.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/admin.c	2003-08-06 19:18:32.000000000 -0400
@@ -213,7 +213,7 @@
         html_write(client, "HTTP/1.0 200 OK\r\n"
                "Content-Type: text/html\r\n"
                "\r\n");
-        DEBUG1("Sending XSLT (%s)", fullpath_xslt_template);
+        DEBUG1("Sending XSLT (%s), %s", fullpath_xslt_template, client->con->ip);
         xslt_transform(doc, fullpath_xslt_template, client);
         free(fullpath_xslt_template);
     }
@@ -227,19 +227,19 @@
     int command;
 
     if(strncmp("/admin/", uri, 7)) {
-        ERROR0("Internal error: admin request isn't");
+        ERROR0("Internal error: admin request isn't, %s", client->con->ip);
         client_send_401(client);
         return;
     }
 
     command_string = uri + 7;
 
-    DEBUG1("Got command (%s)", command_string);
+    DEBUG1("Got command (%s,%s)", command_string, client->con->ip);
     command = admin_get_command(command_string);
 
     if(command < 0) {
-        ERROR1("Error parsing command string or unrecognised command: %s",
-                command_string);
+        ERROR1("Error parsing command string or unrecognised command: %s, %s",
+                command_string, client->con->ip);
         client_send_400(client, "Unrecognised command");
         return;
     }
@@ -253,7 +253,7 @@
         if(!connection_check_admin_pass(client->parser)) {
             if(!connection_check_source_pass(client->parser, mount)) {
                 INFO1("Bad or missing password on mount modification admin "
-                      "request (command: %s)", command_string);
+                      "request (command: %s), %s", command_string, client->con->ip);
                 client_send_401(client);
                 return;
             }
@@ -264,14 +264,14 @@
         avl_tree_unlock(global.source_tree);
 
         if(source == NULL) {
-            WARN2("Admin command %s on non-existent source %s", 
-                    command_string, mount);
+            WARN2("Admin command %s on non-existent source %s, %s", 
+                    command_string, mount, client->con->ip);
             client_send_400(client, "Source does not exist");
             return;
         }
 
-        INFO2("Received admin command %s on mount \"%s\"", 
-                command_string, mount);
+        INFO2("Received admin command %s on mount \"%s\", %s", 
+                command_string, mount, client->con->ip);
 
         admin_handle_mount_request(client, source, command);
     }
@@ -279,7 +279,7 @@
 
         if(!connection_check_admin_pass(client->parser)) {
             INFO1("Bad or missing password on admin command "
-                  "request (command: %s)", command_string);
+                  "request (command: %s), %s", command_string, client->con->ip);
             client_send_401(client);
             return;
         }
@@ -313,7 +313,7 @@
             command_list_mounts(client, TRANSFORMED);
             break;
         default:
-            WARN0("General admin request not recognised");
+            WARN0("General admin request not recognised,, %s", client->con->ip);
             client_send_400(client, "Unknown admin request");
             return;
     }
@@ -357,7 +357,7 @@
             command_kill_source(client, source, TRANSFORMED);
             break;
         default:
-            WARN0("Mount request not recognised");
+            WARN0("Mount request not recognised, %s", client->con->ip);
             client_send_400(client, "Mount request unknown");
             break;
     }
@@ -410,11 +410,11 @@
     char buf[255];
     int parameters_passed = 0;
 
-    DEBUG0("Doing optional check");
+    DEBUG0("Doing optional check, %s", client->con->ip);
     if((COMMAND_OPTIONAL(client, "destination", dest_source))) {
         parameters_passed = 1;
     }
-    DEBUG1("Done optional check (%d)", parameters_passed);
+    DEBUG1("Done optional check (%d), %s", parameters_passed, client->con->ip);
     if (!parameters_passed) {
         doc = admin_build_sourcelist(source->mount);
         admin_send_response(doc, client, response, 
@@ -556,10 +556,10 @@
     doc = xmlNewDoc("1.0");
     node = xmlNewDocNode(doc, NULL, "iceresponse", NULL);
     xmlDocSetRootElement(doc, node);
-    DEBUG1("Response is %d", response);
+    DEBUG1("Response is %d, %s", response, client->con->ip);
 
     if(listener != NULL) {
-        INFO1("Admin request: client %d removed", id);
+        INFO1("Admin request: client %d removed, %s", id, client->con->ip);
 
         /* This tags it for removal on the next iteration of the main source
          * loop
@@ -588,7 +588,7 @@
     char *fallback;
     char *old;
 
-    DEBUG0("Got fallback request");
+    DEBUG0("Got fallback request, %s", client->con->ip);
 
     COMMAND_REQUIRE(client, "fallback", fallback);
 
@@ -609,7 +609,7 @@
     time_t current_time;
 #endif
 
-    DEBUG0("Got metadata update request");
+    DEBUG0("Got metadata update request, %s", client->con->ip);
 
     COMMAND_REQUIRE(client, "mode", action);
     COMMAND_REQUIRE(client, "song", value);
@@ -633,8 +633,8 @@
     state->metadata_raw = 0;
     thread_mutex_unlock(&(state->lock));
 
-    DEBUG2("Metadata on mountpoint %s changed to \"%s\"", 
-        source->mount, value);
+    DEBUG2("Metadata on mountpoint %s changed to \"%s\", %s", 
+        source->mount, value, client->con->ip);
     stats_event(source->mount, "title", value);
 #ifdef USE_YP
     /* If we get an update on the mountpoint, force a
@@ -653,7 +653,7 @@
 static void command_stats(client_t *client, int response) {
     xmlDocPtr doc;
 
-    DEBUG0("Stats request, sending xml stats");
+    DEBUG0("Stats request, sending xml stats, %s", client->con->ip);
 
     stats_get_xml(&doc);
     admin_send_response(doc, client, response, STATS_TRANSFORMED_REQUEST);
@@ -665,7 +665,7 @@
 static void command_list_mounts(client_t *client, int response) {
     xmlDocPtr doc;
 
-    DEBUG0("List mounts request");
+    DEBUG0("List mounts request, %s", client->con->ip);
 
     doc = admin_build_sourcelist(NULL);
 
diff -u --recursive icecast/src/config.c icecast-new/src/config.c
--- icecast/src/config.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/config.c	2003-08-06 19:18:39.000000000 -0400
@@ -594,7 +594,7 @@
     char *tmp;
 
     if (configuration->num_yp_directories >= MAX_YP_DIRECTORIES) {
-        ERROR0("Maximum number of yp directories exceeded!");
+        ERROR0("Maximum number of yp directories exceeded!, %s", "-");
         return;
     }
     do {
diff -u --recursive icecast/src/connection.c icecast-new/src/connection.c
--- icecast/src/connection.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/connection.c	2003-08-06 19:18:46.000000000 -0400
@@ -153,7 +153,7 @@
                 if (ufds[i].revents & (POLLHUP|POLLERR))
                 {
                     close (global.serversock[i]);
-                    WARN0("Had to close a listening socket");
+                    WARN0("Had to close a listening socket, %s", "-");
                 }
                 global.serversock[i] = -1;
             }
@@ -229,7 +229,7 @@
     }
 
     if (!sock_recoverable(sock_error()))
-        WARN2("accept() failed with error %d: %s", sock_error(), strerror(sock_error()));
+        WARN2("accept() failed with error %d: %s, %s", sock_error(), strerror(sock_error()), "-");
     
     free(ip);
 
@@ -415,7 +415,7 @@
     */
     global_lock();
     if (global.sources >= source_limit) {
-        INFO1("Source (%s) logged in, but there are too many sources", mount);
+        INFO1("Source (%s) logged in, but there are too many sources, %s", mount, client->con->ip);
         global_unlock();
         return 0;
     }
@@ -442,7 +442,7 @@
     if (contenttype != NULL) {
         format_type_t format = format_get_type(contenttype);
         if (format == FORMAT_ERROR) {
-            WARN1("Content-type \"%s\" not supported, dropping source", contenttype);
+            WARN1("Content-type \"%s\" not supported, dropping source, %s", contenttype, client->con->ip);
             thread_mutex_unlock(&(config_locks()->mounts_lock));
             goto fail;
         } else {
@@ -452,7 +452,7 @@
         }
     } else {
         format_type_t format = FORMAT_TYPE_MP3;
-        ERROR0("No content-type header, falling back to backwards compatibility mode for icecast 1.x relays. Assuming content is mp3.");
+        ERROR0("No content-type header, falling back to backwards compatibility mode for icecast 1.x relays. Assuming content is mp3., %s", client->con->ip);
         source = source_create(client, con, parser, mount, format, mountinfo);
         thread_mutex_unlock(&(config_locks()->mounts_lock));
     }
@@ -488,8 +488,8 @@
 
     userpass = util_base64_decode(header+6);
     if(userpass == NULL) {
-        WARN1("Base64 decode of Authorization header \"%s\" failed",
-                header+6);
+        WARN1("Base64 decode of Authorization header \"%s\" failed, %s",
+                header+6, "-");
         return 0;
     }
 
@@ -579,7 +579,7 @@
     thread_mutex_unlock(&(config_locks()->mounts_lock));
 
     if(!pass) {
-        WARN0("No source password set, rejecting source");
+        WARN0("No source password set, rejecting source, %s", "-");
         return 0;
     }
 
@@ -593,7 +593,7 @@
         {
             ret = _check_pass_ice(parser, pass);
             if(ret)
-                WARN0("Source is using deprecated icecast login");
+                WARN0("Source is using deprecated icecast login, %s", "-");
         }
     }
     return ret;
@@ -606,11 +606,11 @@
 
     client = client_create(con, parser);
 
-    INFO1("Source logging in at mountpoint \"%s\"", uri);
+    INFO1("Source logging in at mountpoint \"%s\", %s", uri, client->con->ip);
     stats_event_inc(NULL, "source_connections");
                 
     if (!connection_check_source_pass(parser, uri)) {
-        INFO1("Source (%s) attempted to login with invalid or missing password", uri);
+        INFO1("Source (%s) attempted to login with invalid or missing password, %s", uri, client->con->ip);
         client_send_401(client);
         return;
     }
@@ -622,7 +622,7 @@
     avl_tree_rlock(global.source_tree);
     if (source_find_mount(uri) != NULL) {
         avl_tree_unlock(global.source_tree);
-        INFO1("Source tried to log in as %s, but mountpoint is already used", uri);
+        INFO1("Source tried to log in as %s, but mountpoint is already used, %s", uri, client->con->ip);
         client_send_404(client, "Mountpoint in use");
         return;
     }
@@ -641,7 +641,7 @@
     stats_event_inc(NULL, "stats_connections");
                 
     if (!connection_check_admin_pass(parser)) {
-        ERROR0("Bad password for stats connection");
+        ERROR0("Bad password for stats connection, %s", con->ip);
         connection_close(con);
         httpp_destroy(parser);
         return;
@@ -691,7 +691,7 @@
     config_release_config();
 
 
-    DEBUG0("Client connected");
+    DEBUG0("Client connected, %s", con->ip);
 
     /* make a client */
     client = client_create(con, parser);
@@ -730,7 +730,7 @@
     if (util_check_valid_extension(fullpath) == XSLT_CONTENT) {
         /* If the file exists, then transform it, otherwise, write a 404 */
         if (stat(fullpath, &statbuf) == 0) {
-            DEBUG0("Stats request, sending XSL transformed stats");
+            DEBUG0("Stats request, sending XSL transformed stats, %s", client->con->ip);
             client->respcode = 200;
             bytes = sock_write(client->con->sock, 
                     "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n");
@@ -816,7 +816,7 @@
     avl_tree_rlock(global.source_tree);
     source = source_find_mount(uri);
     if (source) {
-        DEBUG0("Source found for client");
+        DEBUG0("Source found for client, %s", client->con->ip);
                         
         global_lock();
         if (global.clients >= client_limit) {
@@ -857,7 +857,7 @@
     avl_tree_unlock(global.source_tree);
                     
     if (!source) {
-        DEBUG0("Source not found for client");
+        DEBUG0("Source not found for client, %s", client->con->ip);
         client_send_404(client, "The source you requested could not be found.");
     }
 }
@@ -886,7 +886,7 @@
                         event_config_read(con->event);
                         break;
                     default:
-                        ERROR1("Unknown event number: %d", con->event_number);
+                        ERROR1("Unknown event number: %d, %s", con->event_number, client->con->ip);
                         break;
                 }
                 free(con);
@@ -911,7 +911,7 @@
                 
                 if (strcmp("ICE",  httpp_getvar(parser, HTTPP_VAR_PROTOCOL)) &&
                     strcmp("HTTP", httpp_getvar(parser, HTTPP_VAR_PROTOCOL))) {
-                    ERROR0("Bad HTTP protocol detected");
+                    ERROR0("Bad HTTP protocol detected, %s", client->con->ip);
                     connection_close(con);
                     httpp_destroy(parser);
                     continue;
@@ -936,7 +936,7 @@
                     _handle_get_request(con, parser, uri);
                 }
                 else {
-                    ERROR0("Wrong request type from client");
+                    ERROR0("Wrong request type from client, %s", client->con->ip);
                     connection_close(con);
                     httpp_destroy(parser);
                 }
@@ -959,7 +959,7 @@
                 _handle_source_request(con, parser, mount);
             }
             else {
-                ERROR0("HTTP request parsing failed");
+                ERROR0("HTTP request parsing failed, %s", client->con->ip);
                 connection_close(con);
                 httpp_destroy(parser);
                 continue;
diff -u --recursive icecast/src/event.c icecast-new/src/event.c
--- icecast/src/event.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/event.c	2003-08-06 19:18:46.000000000 -0400
@@ -18,20 +18,20 @@
                                      to find out the config filename */
     ret = config_parse_file(config->config_filename, &new_config);
     if(ret < 0) {
-        ERROR0("Error parsing config, not replacing existing config");
+        ERROR0("Error parsing config, not replacing existing config, %s", "-");
         switch(ret) {
             case CONFIG_EINSANE:
-                ERROR0("Config filename null or blank");
+                ERROR0("Config filename null or blank, %s", "-");
                 break;
             case CONFIG_ENOROOT:
-                ERROR1("Root element not found in %s", config->config_filename);
+                ERROR1("Root element not found in %s, %s", config->config_filename, "-");
                 break;
             case CONFIG_EBADROOT:
-                ERROR1("Not an icecast2 config file: %s",
-                        config->config_filename);
+                ERROR1("Not an icecast2 config file: %s, %s",
+                        config->config_filename, "-");
                 break;
             default:
-                ERROR1("Parse error in reading %s", config->config_filename);
+                ERROR1("Parse error in reading %s, %s", config->config_filename, "-");
                 break;
         }
         config_release_config();
diff -u --recursive icecast/src/format.c icecast-new/src/format.c
--- icecast/src/format.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/format.c	2003-08-06 19:18:47.000000000 -0400
@@ -85,7 +85,7 @@
 
     if(ret < 0) {
         if(sock_recoverable(sock_error())) {
-            DEBUG1("Client had recoverable error %ld", ret);
+            DEBUG1("Client had recoverable error %ld, %s", ret, client->con->ip);
             ret = 0;
         }
     }
diff -u --recursive icecast/src/format_mp3.c icecast-new/src/format_mp3.c
--- icecast/src/format_mp3.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/format_mp3.c	2003-08-06 19:18:50.000000000 -0400
@@ -188,7 +188,7 @@
 
     if(ret < 0) {
         if(sock_recoverable(sock_error())) {
-            DEBUG1("Client had recoverable error %ld", ret);
+            DEBUG1("Client had recoverable error %ld, %s", ret, client->con->ip);
             ret = 0;
         }
     }
diff -u --recursive icecast/src/format_vorbis.c icecast-new/src/format_vorbis.c
--- icecast/src/format_vorbis.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/format_vorbis.c	2003-08-06 19:18:52.000000000 -0400
@@ -194,7 +194,7 @@
         if (state->header > 0 && state->packets < 3) {
             if(state->header > MAX_HEADER_PAGES) {
                 refbuf_release(refbuf);
-                ERROR1("Bad vorbis input: header is more than %d pages long", MAX_HEADER_PAGES);
+                ERROR1("Bad vorbis input: header is more than %d pages long, %s", MAX_HEADER_PAGES, "-");
 
                 return -1;
             }
diff -u --recursive icecast/src/fserve.c icecast-new/src/fserve.c
--- icecast/src/fserve.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/fserve.c	2003-08-06 19:18:55.000000000 -0400
@@ -241,12 +241,12 @@
                 client->client->con->sent_bytes += sbytes;
             }
             else if(!sock_recoverable(sock_error())) {
-                DEBUG0("Fileserving client had fatal error, disconnecting");
+                DEBUG0("Fileserving client had fatal error, disconnecting, %s", client->client->con->ip);
                 client->client->con->error = 1;
             }
             /*
             else
-                DEBUG0("Fileserving client had recoverable error");
+                DEBUG0("Fileserving client had recoverable error, %s", client->con->ip);
              */
 
             avl_node_unlock(client_node);
diff -u --recursive icecast/src/geturl.c icecast-new/src/geturl.c
--- icecast/src/geturl.c	2003-03-27 12:09:45.000000000 -0500
+++ icecast-new/src/geturl.c	2003-08-06 19:18:56.000000000 -0400
@@ -155,10 +155,10 @@
     return 1;
 }
 void curl_print_header_result(struct curl_memory_struct2 *mem) {
-    DEBUG1("SID -> (%s)", mem->sid);
-    DEBUG1("Message -> (%s)", mem->message);
-    DEBUG1("Touch Freq -> (%d)", mem->touch_interval);
-    DEBUG1("Response -> (%d)", mem->response);
+    DEBUG1("SID -> (%s), %s", mem->sid, client->con->ip);
+    DEBUG1("Message -> (%s), %s", mem->message, client->con->ip);
+    DEBUG1("Touch Freq -> (%d), %s", mem->touch_interval, client->con->ip);
+    DEBUG1("Response -> (%d), %s", mem->response, client->con->ip);
 }
 
 
diff -u --recursive icecast/src/logging.h icecast-new/src/logging.h
--- icecast/src/logging.h	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/logging.h	2003-08-06 19:19:31.000000000 -0400
@@ -19,26 +19,26 @@
 #define __FUNCTION__ __FILE__
 #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)
-#define ERROR3(y, a, b, c) log_write(errorlog, 1, CATMODULE "/", __FUNCTION__, y, a, b, c)
-
-#define WARN0(y) log_write(errorlog, 2, CATMODULE "/", __FUNCTION__, y)
-#define WARN1(y, a) log_write(errorlog, 2, CATMODULE "/", __FUNCTION__, y, a)
-#define WARN2(y, a, b) log_write(errorlog, 2, CATMODULE "/", __FUNCTION__, y, a, b)
-#define WARN3(y, a, b, c) log_write(errorlog, 2, CATMODULE "/", __FUNCTION__, y, a, b, c)
-
-#define INFO0(y) log_write(errorlog, 3, CATMODULE "/", __FUNCTION__, y)
-#define INFO1(y, a) log_write(errorlog, 3, CATMODULE "/", __FUNCTION__, y, a)
-#define INFO2(y, a, b) log_write(errorlog, 3, CATMODULE "/", __FUNCTION__, y, a, b)
-#define INFO3(y, a, b, c) log_write(errorlog, 3, CATMODULE "/", __FUNCTION__, y, a, b, c)
-
-#define DEBUG0(y) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y)
-#define DEBUG1(y, a) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y, a)
-#define DEBUG2(y, a, b) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y, a, b)
-#define DEBUG3(y, a, b, c) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y, a, b, c)
-#define DEBUG4(y, a, b, c, d) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y, a, b, c, d)
+#define ERROR0(y, a) log_write(errorlog, 1, CATMODULE "/", __FUNCTION__, y, a)
+#define ERROR1(y, a, b) log_write(errorlog, 1, CATMODULE "/", __FUNCTION__, y, a, b)
+#define ERROR2(y, a, b, c) log_write(errorlog, 1, CATMODULE "/", __FUNCTION__, y, a, b, c)
+#define ERROR3(y, a, b, c, d) log_write(errorlog, 1, CATMODULE "/", __FUNCTION__, y, a, b, c, d)
+
+#define WARN0(y, a) log_write(errorlog, 2, CATMODULE "/", __FUNCTION__, y, a)
+#define WARN1(y, a, b) log_write(errorlog, 2, CATMODULE "/", __FUNCTION__, y, a, b)
+#define WARN2(y, a, b, c) log_write(errorlog, 2, CATMODULE "/", __FUNCTION__, y, a, b, c)
+#define WARN3(y, a, b, c, d) log_write(errorlog, 2, CATMODULE "/", __FUNCTION__, y, a, b, c, d)
+
+#define INFO0(y, a) log_write(errorlog, 3, CATMODULE "/", __FUNCTION__, y, a)
+#define INFO1(y, a, b) log_write(errorlog, 3, CATMODULE "/", __FUNCTION__, y, a, b)
+#define INFO2(y, a, b, c) log_write(errorlog, 3, CATMODULE "/", __FUNCTION__, y, a, b, c)
+#define INFO3(y, a, b, c, d) log_write(errorlog, 3, CATMODULE "/", __FUNCTION__, y, a, b, c, d)
+
+#define DEBUG0(y, a) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y, a)
+#define DEBUG1(y, a, b) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y, a, b)
+#define DEBUG2(y, a, b, c) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y, a, b, c)
+#define DEBUG3(y, a, b, c, d) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y, a, b, c, d)
+#define DEBUG4(y, a, b, c, d, e) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y, a, b, c, d, e)
 
 /* CATMODULE is the category or module that logging messages come from.
 ** we set one here in cause someone forgets in the .c file.
diff -u --recursive icecast/src/main.c icecast-new/src/main.c
--- icecast/src/main.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/main.c	2003-08-06 19:19:00.000000000 -0400
@@ -408,7 +408,7 @@
     /* Do this after logging init */
     slave_initialize();
 
-    INFO0("icecast server started");
+    INFO0("icecast server started, %s", "-");
 
     /* REM 3D Graphics */
 
@@ -422,7 +422,7 @@
 
     _server_proc();
 
-    INFO0("Shutting down");
+    INFO0("Shutting down, %s", "-");
 
     _shutdown_subsystems();
 
diff -u --recursive icecast/src/sighandler.c icecast-new/src/sighandler.c
--- icecast/src/sighandler.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/sighandler.c	2003-08-06 19:19:02.000000000 -0400
@@ -39,8 +39,8 @@
      * practice.
      */
 
-    INFO1("Caught signal %d, scheduling config reread ...", 
-            signo);
+    INFO1("Caught signal %d, scheduling config reread ..., %s", 
+            signo, "-");
 
     /* reread config file */
 
@@ -54,7 +54,7 @@
 
 void _sig_die(int signo)
 {
-    INFO1("Caught signal %d, shutting down...", signo);
+    INFO1("Caught signal %d, shutting down..., %s", signo, "-");
 
     /* inform the server to start shutting down */
     global.running = ICE_HALTING;
diff -u --recursive icecast/src/slave.c icecast-new/src/slave.c
--- icecast/src/slave.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/slave.c	2003-08-06 19:19:04.000000000 -0400
@@ -83,11 +83,11 @@
     if(!localmount)
         localmount = remotemount;
 
-    DEBUG1("Adding source at mountpoint \"%s\"", localmount);
+    DEBUG1("Adding source at mountpoint \"%s\", %s", localmount, client->con->ip);
 
     streamsock = sock_connect_wto(server, port, 0);
     if (streamsock == SOCK_ERROR) {
-        WARN2("Failed to relay stream from master server, couldn't connect to http://%s:%d", server, port);
+        WARN2("Failed to relay stream from master server, couldn't connect to http://%s:%d, %s", server, port, "-");
         return;
     }
     con = create_connection(streamsock, -1, NULL);
@@ -109,7 +109,7 @@
     }
     memset(header, 0, sizeof(header));
     if (util_read_header(con->sock, header, 4096) == 0) {
-        WARN0("Header read failed");
+        WARN0("Header read failed, %s", con->ip);
         connection_close(con);
         return;
     }
@@ -117,11 +117,11 @@
     httpp_initialize(parser, NULL);
     if(!httpp_parse_response(parser, header, strlen(header), localmount)) {
         if(httpp_getvar(parser, HTTPP_VAR_ERROR_MESSAGE)) {
-            ERROR1("Error parsing relay request: %s", 
-                    httpp_getvar(parser, HTTPP_VAR_ERROR_MESSAGE));
+            ERROR1("Error parsing relay request: %s, %s", 
+                    httpp_getvar(parser, HTTPP_VAR_ERROR_MESSAGE), con->ip);
         }
         else
-            ERROR0("Error parsing relay request");
+            ERROR0("Error parsing relay request, %s", con->ip);
         connection_close(con);
         httpp_destroy(parser);
         return;
@@ -130,7 +130,7 @@
     client = client_create(con, parser);
     if (!connection_create_source(client, con, parser, 
                 httpp_getvar(parser, HTTPP_VAR_URI))) {
-        DEBUG0("Failed to create source");
+        DEBUG0("Failed to create source, %s", client->con->ip);
         client_destroy(client);
     }
 
@@ -183,7 +183,7 @@
             mastersock = sock_connect_wto(server, port, 0);
 
             if (mastersock == SOCK_ERROR) {
-                WARN0("Relay slave failed to contact master server to fetch stream list");
+                WARN0("Relay slave failed to contact master server to fetch stream list, %s", "-");
                 continue;
             }
 
diff -u --recursive icecast/src/source.c icecast-new/src/source.c
--- icecast/src/source.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/source.c	2003-08-06 19:19:09.000000000 -0400
@@ -76,8 +76,8 @@
     if(src->dumpfilename != NULL) {
         src->dumpfile = fopen(src->dumpfilename, "ab");
         if(src->dumpfile == NULL) {
-            WARN2("Cannot open dump file \"%s\" for appending: %s, disabling.",
-                    src->dumpfilename, strerror(errno));
+            WARN2("Cannot open dump file \"%s\" for appending: %s, disabling., %s",
+                    src->dumpfilename, strerror(errno), "-");
         }
     }
 
@@ -340,12 +340,12 @@
     }
 #endif
 
-    DEBUG0("Source creation complete");
+    DEBUG0("Source creation complete, %s", source->client->con->ip);
 
     while (global.running == ICE_RUNNING && source->running) {
         ret = source->format->get_buffer(source->format, NULL, 0, &refbuf);
         if(ret < 0) {
-            WARN0("Bad data from source");
+            WARN0("Bad data from source, %s", source->client->con->ip);
             break;
         }
         bytes = 1; /* Set to > 0 so that the post-loop check won't be tripped */
@@ -357,16 +357,16 @@
                 if (ret < 0 && sock_recoverable (sock_error()))
                    continue;
                 if (ret <= 0) { /* timeout expired */
-                    WARN1("Disconnecting source: socket timeout (%d s) expired",
-                           timeout);
+                    WARN1("Disconnecting source: socket timeout (%d s) expired, %s",
+                           timeout, source->client->con->ip);
                     bytes = 0;
                     break;
                 }
 
                 bytes = sock_read_bytes(source->con->sock, buffer, 4096);
                 if (bytes == 0 || (bytes < 0 && !sock_recoverable(sock_error()))) {
-                    DEBUG1("Disconnecting source due to socket read error: %s",
-                            strerror(sock_error()));
+                    DEBUG1("Disconnecting source due to socket read error: %s, %s",
+                            strerror(sock_error()), source->client->con->ip);
                     break;
                 }
             }
@@ -374,13 +374,13 @@
             source->client->con->sent_bytes += bytes;
             ret = source->format->get_buffer(source->format, buffer, bytes, &refbuf);
             if(ret < 0) {
-                WARN0("Bad data from source");
+                WARN0("Bad data from source, %s", source->client->con->ip);
                 goto done;
             }
         }
 
         if (bytes <= 0) {
-            INFO0("Removing source following disconnection");
+            INFO0("Removing source following disconnection, %s", source->client->con->ip);
             break;
         }
 
@@ -401,8 +401,8 @@
             if(fwrite(refbuf->data, 1, refbuf->len, source->dumpfile) !=
                     refbuf->len) 
             {
-                WARN1("Write to dump file failed, disabling: %s", 
-                        strerror(errno));
+                WARN1("Write to dump file failed, disabling: %s, %s", 
+                        strerror(errno), client->con->ip);
                 fclose(source->dumpfile);
                 source->dumpfile = NULL;
             }
@@ -442,7 +442,7 @@
                     }
                 }
                 else {
-                    DEBUG0("Client has unrecoverable error catching up. Client has probably disconnected");
+                    DEBUG0("Client has unrecoverable error catching up. Client has probably disconnected, %s", client->con->ip);
                     client->con->error = 1;
                     data_done = 1;
                     refbuf_release(abuf);
@@ -472,7 +472,7 @@
                     }
                 }
                 else {
-                    DEBUG0("Client had unrecoverable error with new data, probably due to client disconnection");
+                    DEBUG0("Client had unrecoverable error with new data, probably due to client disconnection, %s", client->con->ip);
                     client->con->error = 1;
                 }
             }
@@ -482,7 +482,7 @@
             ** data, so we'll kick any client who's queue gets to large.
             */
             if (refbuf_queue_length(&client->queue) > queue_limit) {
-                DEBUG0("Client has fallen too far behind, removing");
+                DEBUG0("Client has fallen too far behind, removing, %s", client->con->ip);
                 client->con->error = 1;
             }
 
@@ -510,7 +510,7 @@
                 listeners--;
                 stats_event_args(source->mount, "listeners", "%d", listeners);
                 source->listeners = listeners;
-                DEBUG0("Client removed");
+                DEBUG0("Client removed, %s", source->mount);
                 continue;
             }
             client_node = avl_get_next(client_node);
@@ -526,7 +526,7 @@
             /* listener count may have changed */
             listeners = source->listeners;
             listeners++;
-            DEBUG0("Client added");
+            DEBUG0("Client added, %s", source->mount);
             stats_event_inc(NULL, "clients");
             stats_event_inc(source->mount, "connections");
             stats_event_args(source->mount, "listeners", "%d", listeners);
@@ -557,7 +557,7 @@
 
 done:
 
-    INFO1("Source \"%s\" exiting", source->mount);
+    INFO1("Source \"%s\" exiting, %s", source->mount, source->client->con->ip);
 
 #ifdef USE_YP
     if(source->yp_public) {
diff -u --recursive icecast/src/util.c icecast-new/src/util.c
--- icecast/src/util.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/util.c	2003-08-06 19:19:17.000000000 -0400
@@ -293,7 +293,7 @@
                 done = 1;
                 break;
             case 0:
-                ERROR0("Fatal internal logic error in util_url_unescape()");
+                ERROR0("Fatal internal logic error in util_url_unescape(), %s", "-");
                 free(decoded);
                 return NULL;
                 break;
@@ -324,7 +324,7 @@
     path = util_url_unescape(uri);
 
     if(path == NULL) {
-        WARN1("Error decoding URI: %s\n", uri);
+        WARN1("Error decoding URI: %s\n, %s", uri, "-");
         return NULL;
     }
 
@@ -332,7 +332,7 @@
     if(verify_path(path))
         return path;
     else {
-        WARN1("Rejecting invalid path \"%s\"", path);
+        WARN1("Rejecting invalid path \"%s\", %s", path, "-");
         free(path);
         return NULL;
     }
@@ -476,7 +476,7 @@
     util_dict *prev;
 
     if (!dict || !key) {
-        ERROR0("NULL values passed to util_dict_set()");
+        ERROR0("NULL values passed to util_dict_set(), %s", "-");
         return 0;
     }
 
@@ -491,7 +491,7 @@
     if (!dict) {
         dict = util_dict_new();
         if (!dict) {
-            ERROR0("unable to allocate new dictionary");
+            ERROR0("unable to allocate new dictionary, %s", "-");
             return 0;
         }
         if (prev)
@@ -505,13 +505,13 @@
             prev->next = NULL;
         util_dict_free (dict);
 
-        ERROR0("unable to allocate new dictionary key");
+        ERROR0("unable to allocate new dictionary key, %s", "-");
         return 0;
     }
 
     dict->val = strdup(val);
     if (!dict->val) {
-        ERROR0("unable to allocate new dictionary value");
+        ERROR0("unable to allocate new dictionary value, %s", "-");
         return 0;
     }
 
diff -u --recursive icecast/src/xslt.c icecast-new/src/xslt.c
--- icecast/src/xslt.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/xslt.c	2003-08-06 19:19:18.000000000 -0400
@@ -35,7 +35,7 @@
 #define CATMODULE "xslt"
 
 #include "logging.h"
-
+static char dash[2]="-";
 typedef struct {
     char              *filename;
     time_t             last_modified;
@@ -90,7 +90,7 @@
     struct stat file;
 
     if(stat(fn, &file)) {
-        DEBUG1("Error checking for stylesheet file: %s", strerror(errno));
+        DEBUG1("Error checking for stylesheet file: %s, %s", strerror(errno), dash);
         return NULL;
     }
 
@@ -111,7 +111,7 @@
                     cache[i].stylesheet = xsltParseStylesheetFile(fn);
                     cache[i].cache_age = time(NULL);
                 }
-                DEBUG1("Using cached sheet %i", i);
+                DEBUG1("Using cached sheet %i, %s", i, dash);
                 return cache[i].stylesheet;
             }
         }
diff -u --recursive icecast/src/yp.c icecast-new/src/yp.c
--- icecast/src/yp.c	2003-07-18 16:29:23.000000000 -0400
+++ icecast-new/src/yp.c	2003-08-06 19:19:23.000000000 -0400
@@ -1,4 +1,4 @@
-/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
+* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -50,16 +50,16 @@
     curl_print_header_result(curl_get_header_result(curl_con));
 
     if (curl_get_header_result(curl_con)->response == ACK) {
-        INFO2("Successfull ACK from %s (%s)", type, yp_url);
+        INFO2("Successfull ACK from %s (%s), %s", type, yp_url,"-");
         ret = 1;
     }
     else {
         if (strlen(curl_get_header_result(curl_con)->message) > 0) {
-            ERROR3("Got a NAK from %s(%s) (%s)", type,
-                    curl_get_header_result(curl_con)->message, yp_url);
+            ERROR3("Got a NAK from %s(%s) (%s), %s", type,
+                    curl_get_header_result(curl_con)->message, yp_url, "-");
         }
         else {
-            ERROR2("Got a NAK from %s(Unknown) (%s)", type, yp_url);
+            ERROR2("Got a NAK from %s(Unknown) (%s), %s", type, yp_url, "-");
         }
         ret = 0;
     }
@@ -104,7 +104,7 @@
                     source->ypdata[i]->sid);
             curl_con = curl_get_connection();
             if (curl_con < 0) {
-                ERROR0("Unable to get auth connection");
+                ERROR0("Unable to get auth connection, %s", "-");
             }
             else {
                 /* specify URL to get */
@@ -220,7 +220,7 @@
             
                             curl_con = curl_get_connection();
                             if (curl_con < 0) {
-                                ERROR0("Unable to get auth connection");
+                                ERROR0("Unable to get auth connection, %s", "-");
                             }
                             else {
                                 /* specify URL to get */
@@ -368,7 +368,7 @@
 
                curl_con = curl_get_connection();
                if (curl_con < 0) {
-                   ERROR0("Unable to get auth connection");
+                   ERROR0("Unable to get auth connection, %s", "-");
                }
                else {
                    /* specify URL to get */


-- 
         John Covici
         covici at ccs.covici.com
--- >8 ----
List archives:  http://www.xiph.org/archives/
icecast project homepage: http://www.icecast.org/
To unsubscribe from this list, send a message to 'icecast-dev-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 Icecast-dev mailing list