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

Michael Smith msmith at xiph.org
Thu Oct 3 07:07:35 PDT 2002



msmith      02/10/03 10:07:34

  Modified:    src      source.c
  Log:
  Fix for possible obscure bug leading to source disconnects.

Revision  Changes    Path
1.22      +7 -1      icecast/src/source.c

Index: source.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/source.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- source.c	17 Aug 2002 04:35:23 -0000	1.21
+++ source.c	3 Oct 2002 14:07:34 -0000	1.22
@@ -148,6 +148,7 @@
     stats_event(source->mount, "type", source->format->format_description);
 
         while (global.running == ICE_RUNNING) {
+        bytes = 0;
                 ret = source->format->get_buffer(source->format, NULL, 0, &refbuf);
         if(ret < 0) {
             WARN0("Bad data from source");
@@ -159,13 +160,18 @@
                 ret = util_timed_wait_for_fd(source->con->sock, timeout*1000);
 
                                 if (ret <= 0) { /* timeout expired */
+                    WARN1("Disconnecting source: socket timeout (%d s) expired",
+                           timeout);
                                         bytes = 0;
                                         break;
                                 }
 
                                 bytes = sock_read_bytes(source->con->sock, buffer, 4096);
-				if (bytes == 0 || (bytes < 0 && !sock_recoverable(sock_error()))) 
+				if (bytes == 0 || (bytes < 0 && !sock_recoverable(sock_error()))) {
+                    DEBUG1("Disconnecting source due to socket read error: %s",
+                            strerror(sock_error()));
                     break;
+                }
                         }
                         if (bytes <= 0) break;
             source->client->con->sent_bytes += bytes;

<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