Skip to content

Commit

Permalink
Update gossip/src/contact_info.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Trent Nelson <[email protected]>
  • Loading branch information
behzadnouri and t-nelson authored Jan 19, 2023
1 parent 68288fa commit 7d62da2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gossip/src/contact_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 7d62da2

Please sign in to comment.