diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-05-10 09:13:28 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-05-10 09:13:28 -0400 |
commit | 1eede00a4bd9a7de2acf77393f2fc57aa3196d08 (patch) | |
tree | 688cc901746da198c07db0932bfca14de2c22651 /src/or/hibernate.c | |
parent | beca6a585c5cd594333ae07b0ae3326188f9d67c (diff) | |
parent | 8b4cf7771e869bea4550452ad2cf5634278e0e87 (diff) | |
download | tor-1eede00a4bd9a7de2acf77393f2fc57aa3196d08.tar.gz tor-1eede00a4bd9a7de2acf77393f2fc57aa3196d08.zip |
Merge branch 'ticket26063_squashed'
Diffstat (limited to 'src/or/hibernate.c')
-rw-r--r-- | src/or/hibernate.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/or/hibernate.c b/src/or/hibernate.c index b83167d20c..d7d259470f 100644 --- a/src/or/hibernate.c +++ b/src/or/hibernate.c @@ -883,13 +883,26 @@ hibernate_begin_shutdown(void) hibernate_begin(HIBERNATE_STATE_EXITING, time(NULL)); } -/** Return true iff we are currently hibernating. */ +/** + * Return true iff we are currently hibernating -- that is, if we are in + * any non-live state. + */ MOCK_IMPL(int, we_are_hibernating,(void)) { return hibernate_state != HIBERNATE_STATE_LIVE; } +/** + * Return true iff we are currently _fully_ hibernating -- that is, if we are + * in a state where we expect to handle no network activity at all. + */ +MOCK_IMPL(int, +we_are_fully_hibernating,(void)) +{ + return hibernate_state == HIBERNATE_STATE_DORMANT; +} + /** If we aren't currently dormant, close all connections and become * dormant. */ static void @@ -1187,6 +1200,8 @@ on_hibernate_state_change(hibernate_state_t prev_state) if (prev_state != HIBERNATE_STATE_INITIAL) { rescan_periodic_events(get_options()); } + + reschedule_per_second_timer(); } /** Free all resources held by the accounting module */ |