diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-07-09 10:15:16 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-07-09 10:15:16 -0400 |
commit | 529faef28eb3e8907cfb814516953d6636f50487 (patch) | |
tree | 1d94128124de50ca92b260e450f96959bf943dd9 /src | |
parent | afee785417cba083c4914fd9b6db49498c2eb241 (diff) | |
parent | 69918629f56ee61ff6c538ea53caefefbabf84f6 (diff) | |
download | tor-529faef28eb3e8907cfb814516953d6636f50487.tar.gz tor-529faef28eb3e8907cfb814516953d6636f50487.zip |
Merge branch 'maint-0.3.3' into maint-0.3.4
Diffstat (limited to 'src')
-rw-r--r-- | src/or/router.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/or/router.c b/src/or/router.c index 3879863e82..5485ec913e 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -2028,10 +2028,11 @@ router_compare_to_my_exit_policy(const tor_addr_t *addr, uint16_t port) MOCK_IMPL(int, router_my_exit_policy_is_reject_star,(void)) { - if (!router_get_my_routerinfo()) /* make sure routerinfo exists */ + const routerinfo_t *me = router_get_my_routerinfo(); + if (!me) /* make sure routerinfo exists */ return -1; - return router_get_my_routerinfo()->policy_is_reject_star; + return me->policy_is_reject_star; } /** Return true iff I'm a server and <b>digest</b> is equal to @@ -2636,10 +2637,12 @@ check_descriptor_bandwidth_changed(time_t now) { static time_t last_changed = 0; uint64_t prev, cur; - if (!router_get_my_routerinfo()) + const routerinfo_t *my_ri = router_get_my_routerinfo(); + if (!my_ri) /* make sure routerinfo exists */ return; - prev = router_get_my_routerinfo()->bandwidthcapacity; + prev = my_ri->bandwidthcapacity; + /* Consider ourselves to have zero bandwidth if we're hibernating or * shutting down. */ cur = we_are_hibernating() ? 0 : rep_hist_bandwidth_assess(); @@ -2692,14 +2695,15 @@ check_descriptor_ipaddress_changed(time_t now) const or_options_t *options = get_options(); const char *method = NULL; char *hostname = NULL; + const routerinfo_t *my_ri = router_get_my_routerinfo(); (void) now; - if (router_get_my_routerinfo() == NULL) + if (my_ri == NULL) /* make sure routerinfo exists */ return; /* XXXX ipv6 */ - prev = router_get_my_routerinfo()->addr; + prev = my_ri->addr; if (resolve_my_address(LOG_INFO, options, &cur, &method, &hostname) < 0) { log_info(LD_CONFIG,"options->Address didn't resolve into an IP."); return; @@ -3813,4 +3817,3 @@ router_get_all_orports(const routerinfo_t *ri) fake_node.ri = (routerinfo_t *)ri; return node_get_all_orports(&fake_node); } - |