Pārlūkot izejas kodu

Don't apply read/write buckets to non-limited connections

Fixes bug 9731
Nick Mathewson 10 gadi atpakaļ
vecāks
revīzija
9205552daa
2 mainītis faili ar 9 papildinājumiem un 0 dzēšanām
  1. 3 0
      changes/bug9731
  2. 6 0
      src/or/connection.c

+ 3 - 0
changes/bug9731

@@ -0,0 +1,3 @@
+  o Major bugfixes:
+    - Do not apply connection_consider_empty_read/write_buckets to
+      non-rate-limited connections.

+ 6 - 0
src/or/connection.c

@@ -2483,6 +2483,9 @@ connection_consider_empty_read_buckets(connection_t *conn)
   } else
     return; /* all good, no need to stop it */
 
+  if (!connection_is_rate_limited(conn))
+    return; /* Always okay. */
+
   LOG_FN_CONN(conn, (LOG_DEBUG, LD_NET, "%s", reason));
   conn->read_blocked_on_bw = 1;
   connection_stop_reading(conn);
@@ -2507,6 +2510,9 @@ connection_consider_empty_write_buckets(connection_t *conn)
   } else
     return; /* all good, no need to stop it */
 
+  if (!connection_is_rate_limited(conn))
+    return; /* Always okay. */
+
   LOG_FN_CONN(conn, (LOG_DEBUG, LD_NET, "%s", reason));
   conn->write_blocked_on_bw = 1;
   connection_stop_writing(conn);