connection_read_bucket_decrement() has a side-effect that

we need to get even if we just read 0 bytes


svn:r2656
This commit is contained in:
Roger Dingledine
2004-11-03 10:18:31 +00:00
parent 80f87c09f6
commit 7ce29b02dc
+7 -1
View File
@@ -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;
}