[or-cvs] make flush_buf have a sane return convention

Roger Dingledine arma at seul.org
Sat Feb 28 05:22:09 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	buffers.c 
Log Message:
make flush_buf have a sane return convention


Index: buffers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/buffers.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- buffers.c	27 Feb 2004 01:33:02 -0000	1.63
+++ buffers.c	28 Feb 2004 05:22:07 -0000	1.64
@@ -155,9 +155,11 @@
 }
 
 /* read from socket s, writing onto end of buf.
- * read at most 'at_most' bytes, and in any case don't read more than will fit based on buflen.
- * If read() returns 0, set *reached_eof to 1 and return 0. If you want to tear
- * down the connection return -1, else return the number of bytes read.
+ * read at most 'at_most' bytes, and in any case don't read more than
+ * will fit based on buflen.
+ * If read() returns 0, set *reached_eof to 1 and return 0. If you want
+ * to tear down the connection return -1, else return the number of
+ * bytes read.
  */
 int read_to_buf(int s, int at_most, buf_t *buf, int *reached_eof) {
 
@@ -228,7 +230,7 @@
 
   /* push from buf onto s
    * then memmove to front of buf
-   * return -1 or how many bytes remain to be flushed */
+   * return -1 or how many bytes you just flushed */
 
   int write_result;
 #ifdef MS_WINDOWS
@@ -259,8 +261,7 @@
     log_fn(LOG_DEBUG,"%d: flushed %d bytes, %d ready to flush, %d remain.",
            s,write_result,*buf_flushlen,(int)buf->datalen);
 
-    return *buf_flushlen;
-    /* XXX USE_TLS should change to return write_result like any sane function would */
+    return write_result;
   }
 }
 



More information about the tor-commits mailing list