diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-04-30 12:42:33 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-05-02 09:22:13 -0400 |
commit | 6f42efaa5926a2f1be89e3b591311f2130931db8 (patch) | |
tree | e4cc3cd0485c24e4c4362c32e66f6b46ec2e92ee /src/feature/dirauth/dirauth_periodic.c | |
parent | 996f7c75ba6abd9c4bc884f2c9a3b62889da9134 (diff) | |
download | tor-6f42efaa5926a2f1be89e3b591311f2130931db8.tar.gz tor-6f42efaa5926a2f1be89e3b591311f2130931db8.zip |
Move voteflags.[ch] to become dirauth only.
For various reasons, this was a nontrivial movement. There are
several places in the code where we do something like "update the
flags on this routerstatus or node if we're an authority", and at
least one where we pretended to be an authority when we weren't.
Diffstat (limited to 'src/feature/dirauth/dirauth_periodic.c')
-rw-r--r-- | src/feature/dirauth/dirauth_periodic.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/feature/dirauth/dirauth_periodic.c b/src/feature/dirauth/dirauth_periodic.c index cfbb156b9f..02727d61b4 100644 --- a/src/feature/dirauth/dirauth_periodic.c +++ b/src/feature/dirauth/dirauth_periodic.c @@ -11,6 +11,7 @@ #include "feature/dirauth/reachability.h" #include "feature/stats/rephist.h" +#include "feature/dirauth/bridgeauth.h" #include "feature/dirauth/dirvote.h" #include "feature/dirauth/dirauth_periodic.h" #include "feature/dirauth/authmode.h" @@ -131,6 +132,23 @@ downrate_stability_callback(time_t now, const or_options_t *options) DECLARE_EVENT(downrate_stability, AUTHORITIES, 0); +/** + * Periodic callback: if we're the bridge authority, write a networkstatus + * file to disk. + */ +static int +write_bridge_ns_callback(time_t now, const or_options_t *options) +{ + if (options->BridgeAuthoritativeDir) { + bridgeauth_dump_bridge_status_to_file(now); +#define BRIDGE_STATUSFILE_INTERVAL (30*60) + return BRIDGE_STATUSFILE_INTERVAL; + } + return PERIODIC_EVENT_NO_UPDATE; +} + +DECLARE_EVENT(write_bridge_ns, BRIDGEAUTH, 0); + void dirauth_register_periodic_events(void) { @@ -139,4 +157,5 @@ dirauth_register_periodic_events(void) periodic_events_register(&save_stability_event); periodic_events_register(&check_authority_cert_event); periodic_events_register(&dirvote_event); + periodic_events_register(&write_bridge_ns_event); } |