[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] core/or: Lift slow call out of loop, #33977



commit 42dfcd0ae3f7a872a781452c289b4e47c494d122
Author: Alex Xu (Hello71) <alex_y_xu@xxxxxxxx>
Date:   Thu Apr 23 13:24:08 2020 -0400

    core/or: Lift slow call out of loop, #33977
---
 changes/bug33977         | 4 ++++
 src/core/or/circuituse.c | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/changes/bug33977 b/changes/bug33977
new file mode 100644
index 000000000..b424a811a
--- /dev/null
+++ b/changes/bug33977
@@ -0,0 +1,4 @@
+  o Minor bugfix (refactoring):
+    - Lift circuit_build_times_disabled out of circuit_expire_building loop to
+      save CPU time with many circuits open. Fixes bug 33977; bugfix on
+      0.3.5.9.
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c
index 066d5d437..419ad07f7 100644
--- a/src/core/or/circuituse.c
+++ b/src/core/or/circuituse.c
@@ -548,9 +548,10 @@ circuit_expire_building(void)
              MAX(get_circuit_build_close_time_ms()*2 + 1000,
                  options->SocksTimeout * 1000));
 
+  bool fixed_time = circuit_build_times_disabled(get_options());
+
   SMARTLIST_FOREACH_BEGIN(circuit_get_global_list(), circuit_t *,victim) {
     struct timeval cutoff;
-    bool fixed_time = circuit_build_times_disabled(get_options());
 
     if (!CIRCUIT_IS_ORIGIN(victim) || /* didn't originate here */
         victim->marked_for_close)     /* don't mess with marked circs */

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