From b8ffb00cf1ddf4ff1b64335f8677d600a948fffc Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Thu, 19 May 2011 23:36:20 -0400 Subject: log the reason for publishing a new relay descriptor now we have a better chance of hunting down the root cause of bug 1810. --- src/or/router.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/or/router.c') diff --git a/src/or/router.c b/src/or/router.c index 616a290d8a..49a986d64a 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -87,7 +87,7 @@ set_onion_key(crypto_pk_env_t *k) onionkey = k; onionkey_set_at = time(NULL); tor_mutex_release(key_lock); - mark_my_descriptor_dirty(); + mark_my_descriptor_dirty("set onion key"); } /** Return the current onion key. Requires that the onion key has been @@ -274,7 +274,7 @@ rotate_onion_key(void) now = time(NULL); state->LastRotatedOnionKey = onionkey_set_at = now; tor_mutex_release(key_lock); - mark_my_descriptor_dirty(); + mark_my_descriptor_dirty("rotated onion key"); or_state_mark_dirty(state, get_options()->AvoidDiskWrites ? now+3600 : 0); goto done; error: @@ -908,7 +908,7 @@ router_orport_found_reachable(void) get_options()->_PublishServerDescriptor != NO_AUTHORITY ? " Publishing server descriptor." : ""); can_reach_or_port = 1; - mark_my_descriptor_dirty(); + mark_my_descriptor_dirty("ORPort found reachable"); control_event_server_status(LOG_NOTICE, "REACHABILITY_SUCCEEDED ORADDRESS=%s:%d", me->address, me->or_port); @@ -925,7 +925,7 @@ router_dirport_found_reachable(void) "from the outside. Excellent."); can_reach_dir_port = 1; if (decide_to_advertise_dirport(get_options(), me->dir_port)) - mark_my_descriptor_dirty(); + mark_my_descriptor_dirty("DirPort found reachable"); control_event_server_status(LOG_NOTICE, "REACHABILITY_SUCCEEDED DIRADDRESS=%s:%d", me->address, me->dir_port); @@ -1232,6 +1232,10 @@ router_upload_dir_desc_to_dirservers(int force) return; if (!force && !desc_needs_upload) return; + + log_info(LD_OR, "Uploading relay descriptor to directory authorities%s", + force ? " (forced)" : ""); + desc_needs_upload = 0; desc_len = ri->cache_info.signed_descriptor_len; @@ -1423,6 +1427,8 @@ router_rebuild_descriptor(int force) return -1; } + log_info(LD_OR, "Rebuilding relay descriptor%s", force ? " (forced)" : ""); + ri = tor_malloc_zero(sizeof(routerinfo_t)); ri->cache_info.routerlist_index = -1; ri->address = tor_dup_ip(addr); @@ -1597,14 +1603,15 @@ void mark_my_descriptor_dirty_if_older_than(time_t when) { if (desc_clean_since < when) - mark_my_descriptor_dirty(); + mark_my_descriptor_dirty("time for new descriptor"); } /** Call when the current descriptor is out of date. */ void -mark_my_descriptor_dirty(void) +mark_my_descriptor_dirty(const char *reason) { desc_clean_since = 0; + log_info(LD_OR, "Decided to publish new relay descriptor: %s", reason); } /** How frequently will we republish our descriptor because of large (factor @@ -1629,7 +1636,7 @@ check_descriptor_bandwidth_changed(time_t now) if (last_changed+MAX_BANDWIDTH_CHANGE_FREQ < now) { log_info(LD_GENERAL, "Measured bandwidth has changed; rebuilding descriptor."); - mark_my_descriptor_dirty(); + mark_my_descriptor_dirty("bandwidth has changed"); last_changed = now; } } -- cgit v1.2.3-54-g00ecf