summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-11-03 10:18:31 +0000
committerRoger Dingledine <arma@torproject.org>2004-11-03 10:18:31 +0000
commit12e92eb82f7092112274691a775bc758bd82c646 (patch)
tree9114fc517b3fe6e45763049fe5a8420d400cbd07 /src
parente541319dcb7fef110a2348cc22255786f1571ca8 (diff)
downloadtor-12e92eb82f7092112274691a775bc758bd82c646.tar.gz
tor-12e92eb82f7092112274691a775bc758bd82c646.zip
connection_read_bucket_decrement() has a side-effect that
we need to get even if we just read 0 bytes svn:r2656
Diffstat (limited to 'src')
-rw-r--r--src/or/connection.c8
1 files changed, 7 insertions, 1 deletions
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;
}