From 185b76380348c4d7b4e8a15a9dce8a7a50f33656 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Wed, 27 Oct 2021 18:25:37 +0200 Subject: [PATCH] protocols/identify: Disable address cache by default (#2312) See https://github.com/libp2p/rust-libp2p/issues/2302 for details. --- protocols/identify/CHANGELOG.md | 6 +++--- protocols/identify/src/identify.rs | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/protocols/identify/CHANGELOG.md b/protocols/identify/CHANGELOG.md index 9611597c067..51e0a0b7b7d 100644 --- a/protocols/identify/CHANGELOG.md +++ b/protocols/identify/CHANGELOG.md @@ -5,9 +5,9 @@ - Update dependencies. -- Assist in peer discovery by returning reported listen addresses - of other peers from `addresses_of_peer`. - [PR 2232](https://github.com/libp2p/rust-libp2p/pull/2232) +- Assist in peer discovery by optionally returning reported listen addresses + of other peers from `addresses_of_peer` (see [PR + 2232](https://github.com/libp2p/rust-libp2p/pull/2232)), disabled by default. # 0.30.0 [2021-07-12] diff --git a/protocols/identify/src/identify.rs b/protocols/identify/src/identify.rs index 8a5bfc7613e..7db89d589bf 100644 --- a/protocols/identify/src/identify.rs +++ b/protocols/identify/src/identify.rs @@ -116,6 +116,8 @@ pub struct IdentifyConfig { /// How many entries of discovered peers to keep before we discard /// the least-recently used one. + /// + /// Disabled by default. pub cache_size: usize, } @@ -130,7 +132,7 @@ impl IdentifyConfig { initial_delay: Duration::from_millis(500), interval: Duration::from_secs(5 * 60), push_listen_addr_updates: false, - cache_size: 100, + cache_size: 0, } } @@ -695,6 +697,7 @@ mod tests { let (pubkey, transport) = transport(); let protocol = Identify::new( IdentifyConfig::new("a".to_string(), pubkey.clone()) + .with_cache_size(100) .with_agent_version("b".to_string()), );