aboutsummaryrefslogtreecommitdiff
path: root/src/feature/client/bridges.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2021-10-28 20:53:26 -0400
committerRoger Dingledine <arma@torproject.org>2021-10-28 20:57:28 -0400
commit867c3c6f89ae67bb95cc3c714feb7898dd3c8e3b (patch)
tree1d028fee06f77e0523fb4a9c3df7ce88329bfb97 /src/feature/client/bridges.c
parentd66549c20855b4d75b1a26f18c852327f6a75a05 (diff)
downloadtor-867c3c6f89ae67bb95cc3c714feb7898dd3c8e3b.tar.gz
tor-867c3c6f89ae67bb95cc3c714feb7898dd3c8e3b.zip
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 changes. 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).
Diffstat (limited to 'src/feature/client/bridges.c')
-rw-r--r--src/feature/client/bridges.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/feature/client/bridges.c b/src/feature/client/bridges.c
index bc065a94c4..9e36d26929 100644
--- a/src/feature/client/bridges.c
+++ b/src/feature/client/bridges.c
@@ -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. */
void
-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);
tor_assert(ri->purpose == ROUTER_PURPOSE_BRIDGE);
@@ -984,8 +992,10 @@ learned_bridge_descriptor(routerinfo_t *ri, int from_cache)
entry_guard_learned_bridge_identity(&bridge->addrport_configured,
(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",
+ ri->nickname,
+ from_cache ? "cached" : "fresh", router_describe(ri));
/* If we didn't have a reachable bridge before this one, try directory
* documents again. */
if (first) {