summaryrefslogtreecommitdiff
path: root/src/or/hibernate.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-05-10 09:13:28 -0400
committerNick Mathewson <nickm@torproject.org>2018-05-10 09:13:28 -0400
commit1eede00a4bd9a7de2acf77393f2fc57aa3196d08 (patch)
tree688cc901746da198c07db0932bfca14de2c22651 /src/or/hibernate.c
parentbeca6a585c5cd594333ae07b0ae3326188f9d67c (diff)
parent8b4cf7771e869bea4550452ad2cf5634278e0e87 (diff)
downloadtor-1eede00a4bd9a7de2acf77393f2fc57aa3196d08.tar.gz
tor-1eede00a4bd9a7de2acf77393f2fc57aa3196d08.zip
Merge branch 'ticket26063_squashed'
Diffstat (limited to 'src/or/hibernate.c')
-rw-r--r--src/or/hibernate.c17
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 */