Browse Source

connection_read_bucket_decrement() has a side-effect that
we need to get even if we just read 0 bytes


svn:r2656

Roger Dingledine 21 years ago
parent
commit
12e92eb82f
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/or/connection.c

+ 7 - 1
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;
 }