[or-cvs] connection_read_bucket_decrement() has a side-effect that

Roger Dingledine arma at seul.org
Wed Nov 3 10:18:34 UTC 2004


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

Modified Files:
	connection.c 
Log Message:
connection_read_bucket_decrement() has a side-effect that
we need to get even if we just read 0 bytes


Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.276
retrieving revision 1.277
diff -u -d -r1.276 -r1.277
--- connection.c	3 Nov 2004 01:32:26 -0000	1.276
+++ connection.c	3 Nov 2004 10:18:31 -0000	1.277
@@ -882,9 +882,15 @@
 
   if(result > 0 && !is_local_IP(conn->addr)) { /* remember it */
     rep_hist_note_bytes_read(result, time(NULL));
-    connection_read_bucket_decrement(conn, result);
   }
 
+  /* Call even if result is 0, since the global read bucket may
+   * have reached 0 on a different conn, and this guy needs to
+   * know to stop reading. */
+  /* Longer-term, we should separate this out to read_bucket_decrement
+   * and consider_empty_buckets, and just call the second one always. */
+  connection_read_bucket_decrement(conn, result);
+
   return 0;
 }
 



More information about the tor-commits mailing list