commit f9ba0c65467fe80f65b3789365cfac874198a337
Author: Mike Perry <mikeperry-...@torproject.org>
Date:   Wed Jan 24 00:03:24 2018 +0000

    Bug 24989: Count client hsdir gets towards MaxClientCircuitsPending.
    
    We removed this by breaking them out from general in #13837.
---
 changes/bug24989    | 4 ++++
 src/or/circuituse.c | 2 +-
 src/or/or.h         | 8 ++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/changes/bug24989 b/changes/bug24989
new file mode 100644
index 000000000..a0ea6acf0
--- /dev/null
+++ b/changes/bug24989
@@ -0,0 +1,4 @@
+  o Minor bugfixes (hidden services):
+    - Re-instate counting pending client HSDir fetch circuits against the
+      MaxClientCircuitsPending rate limit. Fixes bug 24989; bugfix on
+      0.3.3.0-alpha-dev.
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index bc9c4bccb..3125fff65 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -384,7 +384,7 @@ count_pending_general_client_circuits(void)
   SMARTLIST_FOREACH_BEGIN(circuit_get_global_list(), circuit_t *, circ) {
     if (circ->marked_for_close ||
         circ->state == CIRCUIT_STATE_OPEN ||
-        circ->purpose != CIRCUIT_PURPOSE_C_GENERAL ||
+        !CIRCUIT_PURPOSE_COUNTS_TOWARDS_MAXPENDING(circ->purpose) ||
         !CIRCUIT_IS_ORIGIN(circ))
       continue;
 
diff --git a/src/or/or.h b/src/or/or.h
index 2397f6651..e54d3806e 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -586,6 +586,14 @@ typedef enum {
 /** True iff the circuit_t c is actually an or_circuit_t */
 #define CIRCUIT_IS_ORCIRC(c) (((circuit_t *)(c))->magic == OR_CIRCUIT_MAGIC)
 
+/** True iff this circuit purpose should count towards the global
+ * pending rate limit (set by MaxClientCircuitsPending). We count all
+ * general purpose circuits, as well as the first step of client onion
+ * service connections (HSDir gets). */
+#define CIRCUIT_PURPOSE_COUNTS_TOWARDS_MAXPENDING(p) \
+    ((p) == CIRCUIT_PURPOSE_C_GENERAL || \
+     (p) == CIRCUIT_PURPOSE_C_HSDIR_GET)
+
 /** How many circuits do we want simultaneously in-progress to handle
  * a given stream? */
 #define MIN_CIRCUITS_HANDLING_STREAM 2

_______________________________________________
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to