From 7d62da2ee737062dc199dca153ea935b52af45a4 Mon Sep 17 00:00:00 2001 From: behzad nouri Date: Thu, 19 Jan 2023 13:36:49 +0000 Subject: [PATCH] Update gossip/src/contact_info.rs Co-authored-by: Trent Nelson --- gossip/src/contact_info.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gossip/src/contact_info.rs b/gossip/src/contact_info.rs index 80ad5962e6b101..abef7849b0a299 100644 --- a/gossip/src/contact_info.rs +++ b/gossip/src/contact_info.rs @@ -224,11 +224,11 @@ impl ContactInfo { // Removes the socket associated with the specified key. fn remove_socket(&mut self, key: u8) { if let Some(index) = self.sockets.iter().position(|entry| entry.key == key) { - let entry = self.sockets.remove(index); + let removed = self.sockets.remove(index); if let Some(next_entry) = self.sockets.get_mut(index) { - next_entry.offset += entry.offset; + next_entry.offset += removed.offset; } - self.maybe_remove_addr(entry.index); + self.maybe_remove_addr(removed.index); if let Some(entry) = self.cache.get_mut(usize::from(key)) { *entry = socket_addr_unspecified(); }