commit c07d854772bda558ef8cf4fd71f2673c7ed00083 Author: Neel Chauhan neel@neelc.org Date: Thu Apr 11 21:28:35 2019 -0400
Remove callback for setting bridges as running --- changes/bug24490 | 2 +- scripts/maint/practracker/exceptions.txt | 8 ++++---- src/core/mainloop/mainloop.c | 20 -------------------- src/feature/nodelist/networkstatus.c | 5 ++++- 4 files changed, 9 insertions(+), 26 deletions(-)
diff --git a/changes/bug24490 b/changes/bug24490 index 1167e9f8d..cf9281c87 100644 --- a/changes/bug24490 +++ b/changes/bug24490 @@ -1,5 +1,5 @@ o Minor bugfixes (bridge authority): - - We set bridges as running in a callback which runs every 5 minutes. + - We set bridges as running when we dump the bridge status to a file. Previously, we set bridges as running in a GETINFO controller, but these shouldn't modify vital data structures. Fixes bug 24490; bugfix on 0.2.0.13-alpha. Patch by Neel Chauhan diff --git a/scripts/maint/practracker/exceptions.txt b/scripts/maint/practracker/exceptions.txt index 7b06683eb..ad5d3e972 100644 --- a/scripts/maint/practracker/exceptions.txt +++ b/scripts/maint/practracker/exceptions.txt @@ -67,11 +67,11 @@ problem function-size /src/core/mainloop/connection.c:connection_handle_read_imp problem function-size /src/core/mainloop/connection.c:connection_buf_read_from_socket() 177 problem function-size /src/core/mainloop/connection.c:connection_handle_write_impl() 241 problem function-size /src/core/mainloop/connection.c:assert_connection_ok() 143 -problem file-size /src/core/mainloop/mainloop.c 3071 -problem include-count /src/core/mainloop/mainloop.c 68 +problem file-size /src/core/mainloop/mainloop.c 3051 +problem include-count /src/core/mainloop/mainloop.c 66 problem function-size /src/core/mainloop/mainloop.c:conn_close_if_marked() 108 problem function-size /src/core/mainloop/mainloop.c:run_connection_housekeeping() 123 -problem function-size /src/core/mainloop/mainloop.c:CALLBACK() 118 +problem function-size /src/core/mainloop/mainloop.c:CALLBACK() 116 problem file-size /src/core/or/channel.c 3476 problem function-size /src/core/or/channeltls.c:channel_tls_handle_var_cell() 160 problem function-size /src/core/or/channeltls.c:channel_tls_process_versions_cell() 170 @@ -276,7 +276,7 @@ problem function-size /src/lib/net/resolve.c:tor_addr_lookup() 110 problem function-size /src/lib/net/socketpair.c:tor_ersatz_socketpair() 102 problem function-size /src/lib/osinfo/uname.c:get_uname() 116 problem function-size /src/lib/process/process_unix.c:process_unix_exec() 220 -problem function-size /src/lib/process/process_win32.c:process_win32_exec() 133 +problem function-size /src/lib/process/process_win32.c:process_win32_exec() 138 problem function-size /src/lib/process/process_win32.c:process_win32_create_pipe() 112 problem function-size /src/lib/process/restrict.c:set_max_file_descriptors() 102 problem function-size /src/lib/process/setuid.c:switch_id() 156 diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c index e845ff416..c9f2b0d89 100644 --- a/src/core/mainloop/mainloop.c +++ b/src/core/mainloop/mainloop.c @@ -76,7 +76,6 @@ #include "feature/control/control_events.h" #include "feature/dirauth/authmode.h" #include "feature/dirauth/reachability.h" -#include "feature/dirauth/voteflags.h" #include "feature/dircache/consdiffmgr.h" #include "feature/dircache/dirserv.h" #include "feature/dircommon/directory.h" @@ -88,7 +87,6 @@ #include "feature/nodelist/networkstatus.h" #include "feature/nodelist/nodelist.h" #include "feature/nodelist/routerlist.h" -#include "feature/nodelist/routerlist_st.h" #include "feature/relay/dns.h" #include "feature/relay/routerkeys.h" #include "feature/relay/routermode.h" @@ -1377,7 +1375,6 @@ CALLBACK(rotate_onion_key); CALLBACK(rotate_x509_certificate); CALLBACK(save_stability); CALLBACK(save_state); -CALLBACK(set_bridge_running); CALLBACK(write_bridge_ns); CALLBACK(write_stats_file); CALLBACK(control_per_second_events); @@ -1456,7 +1453,6 @@ STATIC periodic_event_item_t periodic_events[] = {
/* Bridge Authority only. */ CALLBACK(write_bridge_ns, BRIDGEAUTH, 0), - CALLBACK(set_bridge_running, BRIDGEAUTH, 0),
/* Directory server only. */ CALLBACK(clean_consdiffmgr, DIRSERVER, 0), @@ -2587,22 +2583,6 @@ write_bridge_ns_callback(time_t now, const or_options_t *options) return PERIODIC_EVENT_NO_UPDATE; }
-/** - * Periodic callback: if we're the bridge authority, set the running flag on - * bridges if they're reachable - */ -static int -set_bridge_running_callback(time_t now, const or_options_t *options) -{ - if (authdir_mode_bridge(options)) { - dirserv_set_bridges_running(now); - -#define SET_BRIDGES_RUNNING_INTERVAL (5*60) - return SET_BRIDGES_RUNNING_INTERVAL; - } - return PERIODIC_EVENT_NO_UPDATE; -} - static int heartbeat_callback_first_time = 1;
/** diff --git a/src/feature/nodelist/networkstatus.c b/src/feature/nodelist/networkstatus.c index bc12fa407..20881112a 100644 --- a/src/feature/nodelist/networkstatus.c +++ b/src/feature/nodelist/networkstatus.c @@ -2409,7 +2409,7 @@ networkstatus_getinfo_by_purpose(const char *purpose_string, time_t now) void networkstatus_dump_bridge_status_to_file(time_t now) { - char *status = networkstatus_getinfo_by_purpose("bridge", now); + char *status; char *fname = NULL; char *thresholds = NULL; char *published_thresholds_and_status = NULL; @@ -2418,6 +2418,9 @@ networkstatus_dump_bridge_status_to_file(time_t now) char fingerprint[FINGERPRINT_LEN+1]; char *fingerprint_line = NULL;
+ dirserv_set_bridges_running(now); + status = networkstatus_getinfo_by_purpose("bridge", now); + if (me && crypto_pk_get_fingerprint(me->identity_pkey, fingerprint, 0) >= 0) { tor_asprintf(&fingerprint_line, "fingerprint %s\n", fingerprint);