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

Jack Moffitt jack at xiph.org
Fri Mar 22 13:18:03 PST 2002



jack        02/03/22 13:18:03

  Modified:    src      source.c
  Log:
  We were triggering error logic when no errors had occurred.  Thanks
  to Ricardo Galli for finding this bug.

Revision  Changes    Path
1.10      +5 -5      icecast/src/source.c

Index: source.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/source.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- source.c	2002/02/11 09:11:17	1.9
+++ source.c	2002/03/22 21:18:03	1.10
@@ -209,8 +209,8 @@
                                         bytes = abuf->len;
 
                                 sbytes = sock_write_bytes(client->con->sock, &abuf->data[client->pos], bytes);
-				if (sbytes > 0) client->con->sent_bytes += sbytes;
-				if (sbytes < bytes) {
+				if (sbytes >= 0) client->con->sent_bytes += sbytes;
+				if (sbytes < 0) {
                                         if (!sock_recoverable(sock_error())) {
                                                 printf("SOURCE: Client had unrecoverable error catching up (%ld/%ld)\n", sbytes, bytes);
                                                 client->con->error = 1;
@@ -238,15 +238,15 @@
                                 refbuf_queue_add(&client->queue, refbuf);
                         } else {
                                 sbytes = sock_write_bytes(client->con->sock, refbuf->data, refbuf->len);
-				if (sbytes > 0) client->con->sent_bytes += sbytes;
-				if (sbytes < refbuf->len) {
+				if (sbytes >= 0) client->con->sent_bytes += sbytes;
+				if (sbytes < 0) {
                                         bytes = sock_error();
                                         if (!sock_recoverable(bytes)) {
                                                 printf("SOURCE: client had unrecoverable error %ld with new data (%ld/%ld)\n", bytes, sbytes, refbuf->len);
                                                 client->con->error = 1;
                                         } else {
                                                 printf("SOURCE: recoverable error %ld\n", bytes);
-						client->pos = sbytes>0?sbytes:0;
+						client->pos = sbytes > 0 ? sbytes : 0;
                                                 refbuf_addref(refbuf);
                                                 refbuf_queue_insert(&client->queue, refbuf);
                                         }

<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