From c30be5a82d47328c311ed4bff925e37b6b40411c Mon Sep 17 00:00:00 2001 From: Harini Kannan Date: Sun, 7 Feb 2016 16:07:35 -0500 Subject: Using router_get_my_routerinfo() --- src/or/connection.c | 1 - src/or/dirserv.c | 2 +- src/or/router.c | 24 ++++++++++++------------ 3 files changed, 13 insertions(+), 14 deletions(-) (limited to 'src/or') diff --git a/src/or/connection.c b/src/or/connection.c index 123c33a876..6c2160c8b4 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1111,7 +1111,6 @@ connection_listener_new(const struct sockaddr *listensockaddr, start_reading = 1; tor_addr_from_sockaddr(&addr, listensockaddr, &usePort); - log_notice(LD_NET, "Opening %s on %s", conn_type_to_string(type), fmt_addrport(&addr, usePort)); diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 491557e9cd..bafea5e90b 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -3103,7 +3103,7 @@ dirserv_get_routerdescs(smartlist_t *descs_out, const char *key, DSR_HEX|DSR_SORT_UNIQ); SMARTLIST_FOREACH_BEGIN(digests, const char *, d) { if (router_digest_is_me(d)) { - /* make sure desc_routerinfo exists */ + /* calling router_get_my_routerinfo() to make sure desc_routerinfo exists */ const routerinfo_t *ri = router_get_my_routerinfo(); if (ri) smartlist_add(descs_out, (void*) &(ri->cache_info)); diff --git a/src/or/router.c b/src/or/router.c index 741e1edb22..f09f375830 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -1747,14 +1747,14 @@ router_compare_to_my_exit_policy(const tor_addr_t *addr, uint16_t port) if (tor_addr_is_null(addr)) return -1; - /* look at desc_routerinfo->exit_policy for both the v4 and the v6 - * policies. The exit_policy field in desc_routerinfo is a bit unusual, + /* look at router_get_my_routerinfo()->exit_policy for both the v4 and the v6 + * policies. The exit_policy field in router_get_my_routerinfo() is a bit unusual, * in that it contains IPv6 and IPv6 entries. We don't want to look - * at desc_routerinfio->ipv6_exit_policy, since that's a port summary. */ + * at router_get_my_routerinfo()->ipv6_exit_policy, since that's a port summary. */ if ((tor_addr_family(addr) == AF_INET || tor_addr_family(addr) == AF_INET6)) { return compare_tor_addr_to_addr_policy(addr, port, - desc_routerinfo->exit_policy) != ADDR_POLICY_ACCEPTED; + router_get_my_routerinfo()->exit_policy) != ADDR_POLICY_ACCEPTED; #if 0 } else if (tor_addr_family(addr) == AF_INET6) { return get_options()->IPv6Exit && @@ -1775,7 +1775,7 @@ router_my_exit_policy_is_reject_star,(void)) if (!router_get_my_routerinfo()) /* make sure desc_routerinfo exists */ return -1; - return desc_routerinfo->policy_is_reject_star; + return router_get_my_routerinfo()->policy_is_reject_star; } /** Return true iff I'm a server and digest is equal to @@ -1836,10 +1836,10 @@ router_get_my_descriptor(void) const char *body; if (!router_get_my_routerinfo()) return NULL; - tor_assert(desc_routerinfo->cache_info.saved_location == SAVED_NOWHERE); - body = signed_descriptor_get_body(&desc_routerinfo->cache_info); + tor_assert(router_get_my_routerinfo()->cache_info.saved_location == SAVED_NOWHERE); + body = signed_descriptor_get_body(&router_get_my_routerinfo()->cache_info); /* Make sure this is nul-terminated. */ - tor_assert(!body[desc_routerinfo->cache_info.signed_descriptor_len]); + tor_assert(!body[router_get_my_routerinfo()->cache_info.signed_descriptor_len]); log_debug(LD_GENERAL,"my desc is '%s'", body); return body; } @@ -2242,10 +2242,10 @@ check_descriptor_bandwidth_changed(time_t now) { static time_t last_changed = 0; uint64_t prev, cur; - if (!desc_routerinfo) + if (!router_get_my_routerinfo()) return; - prev = desc_routerinfo->bandwidthcapacity; + prev = router_get_my_routerinfo()->bandwidthcapacity; cur = we_are_hibernating() ? 0 : rep_hist_bandwidth_assess(); if ((prev != cur && (!prev || !cur)) || cur > prev*2 || @@ -2299,11 +2299,11 @@ check_descriptor_ipaddress_changed(time_t now) (void) now; - if (!desc_routerinfo) + if (router_get_my_routerinfo() == NULL) return; /* XXXX ipv6 */ - prev = desc_routerinfo->addr; + prev = router_get_my_routerinfo()->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; -- cgit v1.2.3-54-g00ecf