[tor-commits] [tor/master] Reset dormancy status when the clock jumps.

nickm at torproject.org nickm at torproject.org
Mon Nov 26 21:36:44 UTC 2018


commit d0e6abd0876f0d4adb0b82f5528220a81b34962e
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Nov 13 15:57:18 2018 -0500

    Reset dormancy status when the clock jumps.
---
 src/core/mainloop/mainloop.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index e6dee94fc..2a68e8c09 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -2674,6 +2674,11 @@ update_current_time(time_t now)
   if (seconds_elapsed < -NUM_JUMPED_SECONDS_BEFORE_WARN) {
     // moving back in time is always a bad sign.
     circuit_note_clock_jumped(seconds_elapsed, false);
+
+    /* Don't go dormant just because we jumped in time. */
+    if (is_participating_on_network()) {
+      reset_user_activity(now);
+    }
   } else if (seconds_elapsed >= NUM_JUMPED_SECONDS_BEFORE_WARN) {
     /* Compare the monotonic clock to the result of time(). */
     const int32_t monotime_msec_passed =
@@ -2695,6 +2700,11 @@ update_current_time(time_t now)
     if (clock_jumped || seconds_elapsed >= NUM_IDLE_SECONDS_BEFORE_WARN) {
       circuit_note_clock_jumped(seconds_elapsed, ! clock_jumped);
     }
+
+    /* Don't go dormant just because we jumped in time. */
+    if (is_participating_on_network()) {
+      reset_user_activity(now);
+    }
   } else if (seconds_elapsed > 0) {
     stats_n_seconds_working += seconds_elapsed;
   }





More information about the tor-commits mailing list