Commit e7463be3 authored by Nick Mathewson's avatar Nick Mathewson 🎨
Browse files

Merge branch 'maint-0.3.4'

parents 83de46eb 529faef2
o Minor bugfixes (compilation):
- Fix a compilation warning on some versions of GCC when
building code that calls routerinfo_get_my_routerinfo() twice,
assuming that the second call will succeed if the first one did.
Fixes bug 26269; bugfix on 0.2.8.2-alpha.
...@@ -2045,10 +2045,11 @@ router_compare_to_my_exit_policy(const tor_addr_t *addr, uint16_t port) ...@@ -2045,10 +2045,11 @@ router_compare_to_my_exit_policy(const tor_addr_t *addr, uint16_t port)
MOCK_IMPL(int, MOCK_IMPL(int,
router_my_exit_policy_is_reject_star,(void)) 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 -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 /** Return true iff I'm a server and <b>digest</b> is equal to
...@@ -2653,10 +2654,12 @@ check_descriptor_bandwidth_changed(time_t now) ...@@ -2653,10 +2654,12 @@ check_descriptor_bandwidth_changed(time_t now)
{ {
static time_t last_changed = 0; static time_t last_changed = 0;
uint64_t prev, cur; 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; return;
prev = router_get_my_routerinfo()->bandwidthcapacity; prev = my_ri->bandwidthcapacity;
/* Consider ourselves to have zero bandwidth if we're hibernating or /* Consider ourselves to have zero bandwidth if we're hibernating or
* shutting down. */ * shutting down. */
cur = we_are_hibernating() ? 0 : rep_hist_bandwidth_assess(); cur = we_are_hibernating() ? 0 : rep_hist_bandwidth_assess();
...@@ -2709,14 +2712,15 @@ check_descriptor_ipaddress_changed(time_t now) ...@@ -2709,14 +2712,15 @@ check_descriptor_ipaddress_changed(time_t now)
const or_options_t *options = get_options(); const or_options_t *options = get_options();
const char *method = NULL; const char *method = NULL;
char *hostname = NULL; char *hostname = NULL;
const routerinfo_t *my_ri = router_get_my_routerinfo();
(void) now; (void) now;
if (router_get_my_routerinfo() == NULL) if (my_ri == NULL) /* make sure routerinfo exists */
return; return;
/* XXXX ipv6 */ /* XXXX ipv6 */
prev = router_get_my_routerinfo()->addr; prev = my_ri->addr;
if (resolve_my_address(LOG_INFO, options, &cur, &method, &hostname) < 0) { if (resolve_my_address(LOG_INFO, options, &cur, &method, &hostname) < 0) {
log_info(LD_CONFIG,"options->Address didn't resolve into an IP."); log_info(LD_CONFIG,"options->Address didn't resolve into an IP.");
return; return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment