Skip to content

Commit

Permalink
fix(network): dead lock in peer manager (nervosnetwork#24)
Browse files Browse the repository at this point in the history
Don't use if-let
  • Loading branch information
zeroqn authored and Eason Gao committed Oct 18, 2019
1 parent 1691bfa commit a74017a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/network/src/peer_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,10 @@ impl Inner {
}

pub fn try_remove_addr(&self, addr: &Multiaddr) {
if let Some(pid) = self.addr_pid.read().get(addr) {
self.remove_peer_addr(&pid.clone(), addr);
let opt_pid = self.addr_pid.read().get(addr).cloned();

if let Some(pid) = opt_pid {
self.remove_peer_addr(&pid, addr);
}
}

Expand Down

0 comments on commit a74017a

Please sign in to comment.