Remove callback for setting bridges as running

This commit is contained in:
Neel Chauhan 2019-04-11 21:28:35 -04:00
parent 4172dcaa62
commit c07d854772
4 changed files with 9 additions and 26 deletions

View file

@ -1,5 +1,5 @@
o Minor bugfixes (bridge authority): 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 Previously, we set bridges as running in a GETINFO controller, but
these shouldn't modify vital data structures. Fixes bug 24490; these shouldn't modify vital data structures. Fixes bug 24490;
bugfix on 0.2.0.13-alpha. Patch by Neel Chauhan bugfix on 0.2.0.13-alpha. Patch by Neel Chauhan

View file

@ -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_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:connection_handle_write_impl() 241
problem function-size /src/core/mainloop/connection.c:assert_connection_ok() 143 problem function-size /src/core/mainloop/connection.c:assert_connection_ok() 143
problem file-size /src/core/mainloop/mainloop.c 3071 problem file-size /src/core/mainloop/mainloop.c 3051
problem include-count /src/core/mainloop/mainloop.c 68 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: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: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 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_handle_var_cell() 160
problem function-size /src/core/or/channeltls.c:channel_tls_process_versions_cell() 170 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/net/socketpair.c:tor_ersatz_socketpair() 102
problem function-size /src/lib/osinfo/uname.c:get_uname() 116 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_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/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/restrict.c:set_max_file_descriptors() 102
problem function-size /src/lib/process/setuid.c:switch_id() 156 problem function-size /src/lib/process/setuid.c:switch_id() 156

View file

@ -76,7 +76,6 @@
#include "feature/control/control_events.h" #include "feature/control/control_events.h"
#include "feature/dirauth/authmode.h" #include "feature/dirauth/authmode.h"
#include "feature/dirauth/reachability.h" #include "feature/dirauth/reachability.h"
#include "feature/dirauth/voteflags.h"
#include "feature/dircache/consdiffmgr.h" #include "feature/dircache/consdiffmgr.h"
#include "feature/dircache/dirserv.h" #include "feature/dircache/dirserv.h"
#include "feature/dircommon/directory.h" #include "feature/dircommon/directory.h"
@ -88,7 +87,6 @@
#include "feature/nodelist/networkstatus.h" #include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h" #include "feature/nodelist/nodelist.h"
#include "feature/nodelist/routerlist.h" #include "feature/nodelist/routerlist.h"
#include "feature/nodelist/routerlist_st.h"
#include "feature/relay/dns.h" #include "feature/relay/dns.h"
#include "feature/relay/routerkeys.h" #include "feature/relay/routerkeys.h"
#include "feature/relay/routermode.h" #include "feature/relay/routermode.h"
@ -1377,7 +1375,6 @@ CALLBACK(rotate_onion_key);
CALLBACK(rotate_x509_certificate); CALLBACK(rotate_x509_certificate);
CALLBACK(save_stability); CALLBACK(save_stability);
CALLBACK(save_state); CALLBACK(save_state);
CALLBACK(set_bridge_running);
CALLBACK(write_bridge_ns); CALLBACK(write_bridge_ns);
CALLBACK(write_stats_file); CALLBACK(write_stats_file);
CALLBACK(control_per_second_events); CALLBACK(control_per_second_events);
@ -1456,7 +1453,6 @@ STATIC periodic_event_item_t periodic_events[] = {
/* Bridge Authority only. */ /* Bridge Authority only. */
CALLBACK(write_bridge_ns, BRIDGEAUTH, 0), CALLBACK(write_bridge_ns, BRIDGEAUTH, 0),
CALLBACK(set_bridge_running, BRIDGEAUTH, 0),
/* Directory server only. */ /* Directory server only. */
CALLBACK(clean_consdiffmgr, DIRSERVER, 0), 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; 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; static int heartbeat_callback_first_time = 1;
/** /**

View file

@ -2409,7 +2409,7 @@ networkstatus_getinfo_by_purpose(const char *purpose_string, time_t now)
void void
networkstatus_dump_bridge_status_to_file(time_t now) networkstatus_dump_bridge_status_to_file(time_t now)
{ {
char *status = networkstatus_getinfo_by_purpose("bridge", now); char *status;
char *fname = NULL; char *fname = NULL;
char *thresholds = NULL; char *thresholds = NULL;
char *published_thresholds_and_status = 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[FINGERPRINT_LEN+1];
char *fingerprint_line = NULL; 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, if (me && crypto_pk_get_fingerprint(me->identity_pkey,
fingerprint, 0) >= 0) { fingerprint, 0) >= 0) {
tor_asprintf(&fingerprint_line, "fingerprint %s\n", fingerprint); tor_asprintf(&fingerprint_line, "fingerprint %s\n", fingerprint);