From: Roger Dingledine Date: Wed, 3 Nov 2004 10:18:31 +0000 (+0000) Subject: connection_read_bucket_decrement() has a side-effect that X-Git-Tag: debian-version-0.0.8+0.0.9pre5-1~125 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12e92eb82f7092112274691a775bc758bd82c646;p=thirdparty%2Ftor.git connection_read_bucket_decrement() has a side-effect that we need to get even if we just read 0 bytes svn:r2656 --- diff --git a/src/or/connection.c b/src/or/connection.c index 9cdf4ee984..2d8a8f3194 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -882,9 +882,15 @@ static int connection_read_to_buf(connection_t *conn) { 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; }