summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-04-30 12:42:33 -0400
committerNick Mathewson <nickm@torproject.org>2019-05-02 09:22:13 -0400
commit6f42efaa5926a2f1be89e3b591311f2130931db8 (patch)
treee4cc3cd0485c24e4c4362c32e66f6b46ec2e92ee /src/core
parent996f7c75ba6abd9c4bc884f2c9a3b62889da9134 (diff)
downloadtor-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/core')
-rw-r--r--src/core/include.am9
-rw-r--r--src/core/mainloop/mainloop.c21
2 files changed, 7 insertions, 23 deletions
diff --git a/src/core/include.am b/src/core/include.am
index 6367b01978..63d4264210 100644
--- a/src/core/include.am
+++ b/src/core/include.am
@@ -153,8 +153,8 @@ LIBTOR_APP_A_SOURCES = \
# These should eventually move into module_dirauth_sources, but for now
# the separation is only in the code location.
LIBTOR_APP_A_SOURCES += \
- src/feature/dirauth/bwauth.c \
- src/feature/dirauth/voteflags.c
+ src/feature/dirauth/bwauth.c
+
if BUILD_NT_SERVICES
LIBTOR_APP_A_SOURCES += src/app/main/ntmain.c
@@ -171,6 +171,7 @@ LIBTOR_APP_TESTING_A_SOURCES = $(LIBTOR_APP_A_SOURCES)
# The Directory Authority module.
MODULE_DIRAUTH_SOURCES = \
src/feature/dirauth/authmode.c \
+ src/feature/dirauth/bridgeauth.c \
src/feature/dirauth/dirauth_periodic.c \
src/feature/dirauth/dirauth_sys.c \
src/feature/dirauth/dircollate.c \
@@ -181,7 +182,8 @@ MODULE_DIRAUTH_SOURCES = \
src/feature/dirauth/reachability.c \
src/feature/dirauth/recommend_pkg.c \
src/feature/dirauth/shared_random.c \
- src/feature/dirauth/shared_random_state.c
+ src/feature/dirauth/shared_random_state.c \
+ src/feature/dirauth/voteflags.c
if BUILD_MODULE_DIRAUTH
LIBTOR_APP_A_SOURCES += $(MODULE_DIRAUTH_SOURCES)
@@ -310,6 +312,7 @@ noinst_HEADERS += \
src/feature/control/fmt_serverstatus.h \
src/feature/control/getinfo_geoip.h \
src/feature/dirauth/authmode.h \
+ src/feature/dirauth/bridgeauth.h \
src/feature/dirauth/bwauth.h \
src/feature/dirauth/dirauth_periodic.h \
src/feature/dirauth/dirauth_sys.h \
diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index 30dad956ae..eb875df023 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -75,6 +75,7 @@
#include "feature/control/control.h"
#include "feature/control/control_events.h"
#include "feature/dirauth/authmode.h"
+#include "feature/dirauth/bridgeauth.h"
#include "feature/dircache/consdiffmgr.h"
#include "feature/dircache/dirserv.h"
#include "feature/dircommon/directory.h"
@@ -1366,7 +1367,6 @@ CALLBACK(retry_listeners);
CALLBACK(rotate_onion_key);
CALLBACK(rotate_x509_certificate);
CALLBACK(save_state);
-CALLBACK(write_bridge_ns);
CALLBACK(write_stats_file);
CALLBACK(control_per_second_events);
CALLBACK(second_elapsed);
@@ -1433,9 +1433,6 @@ STATIC periodic_event_item_t mainloop_periodic_events[] = {
/* XXXX this could be restricted to CLIENT+NET_PARTICIPANT */
CALLBACK(rend_cache_failure_clean, NET_PARTICIPANT, FL(RUN_ON_DISABLE)),
- /* Bridge Authority only. */
- CALLBACK(write_bridge_ns, BRIDGEAUTH, 0),
-
/* Directory server only. */
CALLBACK(clean_consdiffmgr, DIRSERVER, 0),
@@ -2369,22 +2366,6 @@ check_dns_honesty_callback(time_t now, const or_options_t *options)
return 12*3600 + crypto_rand_int(12*3600);
}
-/**
- * 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)
-{
- /* 10. write bridge networkstatus file to disk */
- if (options->BridgeAuthoritativeDir) {
- networkstatus_dump_bridge_status_to_file(now);
-#define BRIDGE_STATUSFILE_INTERVAL (30*60)
- return BRIDGE_STATUSFILE_INTERVAL;
- }
- return PERIODIC_EVENT_NO_UPDATE;
-}
-
static int heartbeat_callback_first_time = 1;
/**