Commit 867c3c6f authored by Roger Dingledine's avatar Roger Dingledine
Browse files

only log "new bridge descriptor" if really new

The bridge descriptor fetching codes ends up fetching a lot of duplicate
bridge descriptors, because this is how we learn when the descriptor

This commit only changes comments plus whether we log that one line.

It moves us back to the old behavior, before the previous commit for
30496, where we would only log that line when the bridge descriptor
we're talking about is better than the one we already had (if any).
parent d66549c2
......@@ -943,9 +943,17 @@ rewrite_node_address_for_bridge(const bridge_info_t *bridge, node_t *node)
/** We just learned a descriptor for a bridge. See if that
* digest is in our entry guard list, and add it if not. */
* digest is in our entry guard list, and add it if not. Schedule the
* next fetch for a long time from now, and initiate any follow-up
* activities like continuing to bootstrap.
* <b>from_cache</b> * tells us whether we fetched it from disk (else
* the network)
* <b>desc_is_new</b> tells us if we preferred it to the old version we
* had, if any. */
learned_bridge_descriptor(routerinfo_t *ri, int from_cache)
learned_bridge_descriptor(routerinfo_t *ri, int from_cache, int desc_is_new)
tor_assert(ri->purpose == ROUTER_PURPOSE_BRIDGE);
......@@ -984,8 +992,10 @@ learned_bridge_descriptor(routerinfo_t *ri, int from_cache)
(const uint8_t*)ri->cache_info.identity_digest);
log_notice(LD_DIR, "new bridge descriptor '%s' (%s): %s", ri->nickname,
from_cache ? "cached" : "fresh", router_describe(ri));
if (desc_is_new)
log_notice(LD_DIR, "new bridge descriptor '%s' (%s): %s",
from_cache ? "cached" : "fresh", router_describe(ri));
/* If we didn't have a reachable bridge before this one, try directory
* documents again. */
if (first) {
......@@ -46,7 +46,8 @@ void learned_router_identity(const tor_addr_t *addr, uint16_t port,
void bridge_add_from_config(struct bridge_line_t *bridge_line);
void retry_bridge_descriptor_fetch_directly(const char *digest);
void fetch_bridge_descriptors(const or_options_t *options, time_t now);
void learned_bridge_descriptor(routerinfo_t *ri, int from_cache);
void learned_bridge_descriptor(routerinfo_t *ri,
int from_cache, int desc_is_new);
const smartlist_t *get_socks_args_by_bridge_addrport(const tor_addr_t *addr,
uint16_t port);
......@@ -1622,7 +1622,7 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
* let the bridge descriptor fetch subsystem know that we
* succeeded at getting it -- so we can adjust the retry schedule
* to stop trying for a while. */
learned_bridge_descriptor(router, from_cache);
learned_bridge_descriptor(router, from_cache, 0);
"Dropping descriptor that we already have for router %s",
......@@ -2054,7 +2054,7 @@ routerlist_descriptors_added(smartlist_t *sl, int from_cache)
SMARTLIST_FOREACH_BEGIN(sl, routerinfo_t *, ri) {
if (ri->purpose == ROUTER_PURPOSE_BRIDGE)
learned_bridge_descriptor(ri, from_cache);
learned_bridge_descriptor(ri, from_cache, 1);
if (ri->needs_retest_if_added) {
ri->needs_retest_if_added = 0;
dirserv_single_reachability_test(approx_time(), ri);
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