diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-07-01 15:29:05 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-07-01 15:29:05 -0400 |
commit | aaa31290431ea2cd1d1e8498dbe271eb53d2389d (patch) | |
tree | d7ff38ffee26c5ab4571f089e8cf06d9e687a14c /src/or/main.c | |
parent | 738a8c655a1f8067b330b132164fa8879ef102c3 (diff) | |
parent | 36e201dffc5d57d92113e1e68ad4b6a0a7b3471e (diff) | |
download | tor-aaa31290431ea2cd1d1e8498dbe271eb53d2389d.tar.gz tor-aaa31290431ea2cd1d1e8498dbe271eb53d2389d.zip |
Merge remote-tracking branch 'dgoulet/ticket16943_029_05-squashed'
Trivial Conflicts:
src/or/or.h
src/or/routerparse.c
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c index 65a67a9923..f6575544d9 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -57,6 +57,7 @@ #include "routerlist.h" #include "routerparse.h" #include "scheduler.h" +#include "shared_random.h" #include "statefile.h" #include "status.h" #include "util_process.h" @@ -2447,6 +2448,13 @@ do_main_loop(void) cpu_init(); } + /* Setup shared random protocol subsystem. */ + if (authdir_mode_publishes_statuses(get_options())) { + if (sr_init(1) < 0) { + return -1; + } + } + /* set up once-a-second callback. */ if (! second_timer) { struct timeval one_second; @@ -3214,6 +3222,9 @@ tor_cleanup(void) accounting_record_bandwidth_usage(now, get_or_state()); or_state_mark_dirty(get_or_state(), 0); /* force an immediate save. */ or_state_save(now); + if (authdir_mode(options)) { + sr_save_and_cleanup(); + } if (authdir_mode_tests_reachability(options)) rep_hist_record_mtbf_data(now, 0); keypin_close_journal(); @@ -3372,6 +3383,7 @@ sandbox_init_filter(void) OPEN_DATADIR_SUFFIX("cached-extrainfo.new", ".tmp"); OPEN_DATADIR("cached-extrainfo.tmp.tmp"); OPEN_DATADIR_SUFFIX("state", ".tmp"); + OPEN_DATADIR_SUFFIX("sr-state", ".tmp"); OPEN_DATADIR_SUFFIX("unparseable-desc", ".tmp"); OPEN_DATADIR_SUFFIX("v3-status-votes", ".tmp"); OPEN_DATADIR("key-pinning-journal"); @@ -3424,6 +3436,7 @@ sandbox_init_filter(void) RENAME_SUFFIX("cached-extrainfo", ".new"); RENAME_SUFFIX("cached-extrainfo.new", ".tmp"); RENAME_SUFFIX("state", ".tmp"); + RENAME_SUFFIX("sr-state", ".tmp"); RENAME_SUFFIX("unparseable-desc", ".tmp"); RENAME_SUFFIX("v3-status-votes", ".tmp"); |