[or-cvs] clean up some more.
Roger Dingledine
arma at seul.org
Sun Nov 21 11:20:30 UTC 2004
Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or
Modified Files:
buffers.c relay.c
Log Message:
clean up some more.
i think i'm getting closer.
Index: buffers.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/buffers.c,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- buffers.c 10 Nov 2004 14:26:34 -0000 1.114
+++ buffers.c 21 Nov 2004 11:20:28 -0000 1.115
@@ -159,9 +159,9 @@
}
/** Read from socket <b>s</b>, writing onto end of <b>buf</b>. Read at most
- * <b>at_most</b> bytes, resizing the buffer as necessary. If read()
+ * <b>at_most</b> bytes, resizing the buffer as necessary. If recv()
* returns 0, set <b>*reached_eof</b> to 1 and return 0. Return -1 on error;
- * else return the number of bytes read. Return 0 if read() would
+ * else return the number of bytes read. Return 0 if recv() would
* block.
*/
int read_to_buf(int s, size_t at_most, buf_t *buf, int *reached_eof) {
Index: relay.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/relay.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- relay.c 21 Nov 2004 09:39:01 -0000 1.23
+++ relay.c 21 Nov 2004 11:20:28 -0000 1.24
@@ -1009,7 +1009,7 @@
/** Check if the package window for <b>circ</b> is empty (at
* hop <b>layer_hint</b> if it's defined).
*
- * If yes, tell edge streams to stop reading and return -1.
+ * If yes, tell edge streams to stop reading and return 1.
* Else return 0.
*/
static int
@@ -1017,13 +1017,19 @@
{
connection_t *conn = NULL;
- log_fn(LOG_DEBUG,"considering");
- if(!layer_hint && circ->package_window <= 0) {
- log_fn(LOG_DEBUG,"yes, not-at-origin. stopped.");
- for(conn = circ->n_streams; conn; conn=conn->next_stream)
- connection_stop_reading(conn);
- return -1;
- } else if(layer_hint && layer_hint->package_window <= 0) {
+ if (!layer_hint) {
+ log_fn(LOG_DEBUG,"considering circ->package_window %d", circ->package_window);
+ if (circ->package_window <= 0) {
+ log_fn(LOG_DEBUG,"yes, not-at-origin. stopped.");
+ for(conn = circ->n_streams; conn; conn=conn->next_stream)
+ connection_stop_reading(conn);
+ return 1;
+ }
+ return 0;
+ }
+ /* else, layer hint is defined, use it */
+ log_fn(LOG_DEBUG,"considering layer_hint->package_window %d", layer_hint->package_window);
+ if (layer_hint->package_window <= 0) {
log_fn(LOG_DEBUG,"yes, at-origin. stopped.");
for(conn = circ->n_streams; conn; conn=conn->next_stream)
if(conn->cpath_layer == layer_hint)
@@ -1031,7 +1037,7 @@
for(conn = circ->p_streams; conn; conn=conn->next_stream)
if(conn->cpath_layer == layer_hint)
connection_stop_reading(conn);
- return -1;
+ return 1;
}
return 0;
}
More information about the tor-commits
mailing list