From 63e9e39538d7a41f05421fa11fc398fe7152a383 Mon Sep 17 00:00:00 2001 From: Fedor Sakharov Date: Tue, 19 Mar 2019 17:23:58 +0300 Subject: [PATCH] swarm: return references from external_addresses (#1008) --- core/src/swarm.rs | 5 ++--- protocols/identify/src/identify.rs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/core/src/swarm.rs b/core/src/swarm.rs index 5f53aa27..da333530 100644 --- a/core/src/swarm.rs +++ b/core/src/swarm.rs @@ -410,10 +410,9 @@ impl<'a> PollParameters<'a> { } /// Returns the list of the addresses nodes can use to reach us. - // TODO: should return references #[inline] - pub fn external_addresses<'b>(&'b mut self) -> impl ExactSizeIterator + 'b { - self.external_addrs.iter().cloned() + pub fn external_addresses(&self) -> impl ExactSizeIterator { + self.external_addrs.iter() } /// Returns the peer id of the local node. diff --git a/protocols/identify/src/identify.rs b/protocols/identify/src/identify.rs index 0722ba8a..fdf2ea90 100644 --- a/protocols/identify/src/identify.rs +++ b/protocols/identify/src/identify.rs @@ -148,7 +148,7 @@ where .map(|p| String::from_utf8_lossy(p).to_string()) .collect(); - let mut listen_addrs: Vec<_> = params.external_addresses().collect(); + let mut listen_addrs: Vec<_> = params.external_addresses().cloned().collect(); listen_addrs.extend(params.listened_addresses().cloned()); let send_back_info = IdentifyInfo {