summaryrefslogtreecommitdiff
path: root/src/or/statefile.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-04-27 10:30:30 -0400
committerNick Mathewson <nickm@torproject.org>2018-04-30 16:46:52 -0400
commit987a7f667698576d745674965973871363ffd719 (patch)
treec77dd1f6752871c072517876d7d61441350f96f8 /src/or/statefile.c
parent9f8b60d74c91f4028b68ea8345a5562768acc81e (diff)
downloadtor-987a7f667698576d745674965973871363ffd719.tar.gz
tor-987a7f667698576d745674965973871363ffd719.zip
Move responsibility for or_state_save() to a scheduled callback
Closes ticket 25948.
Diffstat (limited to 'src/or/statefile.c')
-rw-r--r--src/or/statefile.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/or/statefile.c b/src/or/statefile.c
index 26a631ced0..c81ea44e06 100644
--- a/src/or/statefile.c
+++ b/src/or/statefile.c
@@ -37,6 +37,7 @@
#include "control.h"
#include "entrynodes.h"
#include "hibernate.h"
+#include "main.h"
#include "rephist.h"
#include "router.h"
#include "sandbox.h"
@@ -472,7 +473,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
@@ -686,8 +687,10 @@ save_transport_to_state(const char *transport,
void
or_state_mark_dirty(or_state_t *state, time_t when)
{
- if (state->next_write > when)
+ if (state->next_write > when) {
state->next_write = when;
+ reschedule_or_state_save();
+ }
}
STATIC void