diff options
author | Neel Chauhan <neel@neelc.org> | 2019-04-11 20:44:30 -0400 |
---|---|---|
committer | Neel Chauhan <neel@neelc.org> | 2019-04-11 20:44:30 -0400 |
commit | 4172dcaa62b02593910736110d9d2c94052dbdcb (patch) | |
tree | 33e78ed27f44153c0c578a337d1f8bc938e3a763 | |
parent | e16f5184dad6d0052df37496327e2652d9c79d00 (diff) | |
download | tor-4172dcaa62b02593910736110d9d2c94052dbdcb.tar.gz tor-4172dcaa62b02593910736110d9d2c94052dbdcb.zip |
Move code for setting bridges as running to voteflags.c
-rw-r--r-- | scripts/maint/practracker/exceptions.txt | 4 | ||||
-rw-r--r-- | src/core/mainloop/mainloop.c | 7 | ||||
-rw-r--r-- | src/feature/dirauth/voteflags.c | 18 | ||||
-rw-r--r-- | src/feature/dirauth/voteflags.h | 2 |
4 files changed, 23 insertions, 8 deletions
diff --git a/scripts/maint/practracker/exceptions.txt b/scripts/maint/practracker/exceptions.txt index a9fcf9095a..7b06683eb7 100644 --- a/scripts/maint/practracker/exceptions.txt +++ b/scripts/maint/practracker/exceptions.txt @@ -67,7 +67,7 @@ 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 3076 +problem file-size /src/core/mainloop/mainloop.c 3071 problem include-count /src/core/mainloop/mainloop.c 68 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 @@ -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() 138 +problem function-size /src/lib/process/process_win32.c:process_win32_exec() 133 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 fd711fd3bc..e845ff416e 100644 --- a/src/core/mainloop/mainloop.c +++ b/src/core/mainloop/mainloop.c @@ -2595,12 +2595,7 @@ static int set_bridge_running_callback(time_t now, const or_options_t *options) { if (authdir_mode_bridge(options)) { - routerlist_t *rl = router_get_routerlist(); - - SMARTLIST_FOREACH_BEGIN(rl->routers, routerinfo_t *, ri) { - if (ri->purpose == ROUTER_PURPOSE_BRIDGE) - dirserv_set_router_is_running(ri, now); - } SMARTLIST_FOREACH_END(ri); + dirserv_set_bridges_running(now); #define SET_BRIDGES_RUNNING_INTERVAL (5*60) return SET_BRIDGES_RUNNING_INTERVAL; diff --git a/src/feature/dirauth/voteflags.c b/src/feature/dirauth/voteflags.c index 0a53c588d6..4040f162fa 100644 --- a/src/feature/dirauth/voteflags.c +++ b/src/feature/dirauth/voteflags.c @@ -29,6 +29,7 @@ #include "feature/nodelist/node_st.h" #include "feature/nodelist/routerinfo_st.h" +#include "feature/nodelist/routerlist_st.h" #include "feature/nodelist/vote_routerstatus_st.h" #include "lib/container/order.h" @@ -658,3 +659,20 @@ dirserv_set_routerstatus_testing(routerstatus_t *rs) rs->is_hs_dir = 0; } } + +/** Use dirserv_set_router_is_running() to set bridges as running if they're + * reachable. + * + * This function is called from set_bridge_running_callback() when running as + * a bridge authority. + */ +void +dirserv_set_bridges_running(time_t now) +{ + routerlist_t *rl = router_get_routerlist(); + + SMARTLIST_FOREACH_BEGIN(rl->routers, routerinfo_t *, ri) { + if (ri->purpose == ROUTER_PURPOSE_BRIDGE) + dirserv_set_router_is_running(ri, now); + } SMARTLIST_FOREACH_END(ri); +} diff --git a/src/feature/dirauth/voteflags.h b/src/feature/dirauth/voteflags.h index cca6f53746..18b29a5183 100644 --- a/src/feature/dirauth/voteflags.h +++ b/src/feature/dirauth/voteflags.h @@ -25,6 +25,8 @@ void set_routerstatus_from_routerinfo(routerstatus_t *rs, void dirserv_compute_performance_thresholds(digestmap_t *omit_as_sybil); +void dirserv_set_bridges_running(time_t now); + #ifdef VOTEFLAGS_PRIVATE /** Any descriptor older than this age causes the authorities to set the * StaleDesc flag. */ |