summaryrefslogtreecommitdiff
path: root/src/or/statefile.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-04-27 10:05:53 -0400
committerNick Mathewson <nickm@torproject.org>2018-04-27 10:09:16 -0400
commit9f8b60d74c91f4028b68ea8345a5562768acc81e (patch)
treea5142b04b596e9167063e1abfaf6784b278dae92 /src/or/statefile.c
parent3a47dfed349ee2c05f30ba142d3583772fa2287f (diff)
downloadtor-9f8b60d74c91f4028b68ea8345a5562768acc81e.tar.gz
tor-9f8b60d74c91f4028b68ea8345a5562768acc81e.zip
Move or_state_mark_dirty into statefile.c
Previously it was an inline function in or.h
Diffstat (limited to 'src/or/statefile.c')
-rw-r--r--src/or/statefile.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/or/statefile.c b/src/or/statefile.c
index cc114f0a2b..26a631ced0 100644
--- a/src/or/statefile.c
+++ b/src/or/statefile.c
@@ -472,7 +472,7 @@ or_state_save(time_t now)
tor_assert(global_state);
- if (global_state->next_write > now)
+ if (global_state->next_write >= now)
return 0;
/* Call everything else that might dirty the state even more, in order
@@ -680,6 +680,16 @@ save_transport_to_state(const char *transport,
tor_free(transport_addrport);
}
+/** Change the next_write time of <b>state</b> to <b>when</b>, unless the
+ * state is already scheduled to be written to disk earlier than <b>when</b>.
+ */
+void
+or_state_mark_dirty(or_state_t *state, time_t when)
+{
+ if (state->next_write > when)
+ state->next_write = when;
+}
+
STATIC void
or_state_free_(or_state_t *state)
{