File tree 2 files changed +8
-7
lines changed
beacon_node/eth2_libp2p/src/peer_manager
2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
319
319
self . network_globals
320
320
. peers
321
321
. write ( )
322
- . notify_disconnecting ( & peer_id, true ) ;
322
+ . notify_disconnecting ( peer_id, true ) ;
323
323
return ;
324
324
}
325
325
@@ -339,7 +339,7 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
339
339
self . network_globals
340
340
. peers
341
341
. write ( )
342
- . notify_disconnecting ( & peer_id, false ) ;
342
+ . notify_disconnecting ( peer_id, false ) ;
343
343
return ;
344
344
}
345
345
@@ -1023,7 +1023,7 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
1023
1023
1024
1024
let mut peer_db = self . network_globals . peers . write ( ) ;
1025
1025
for peer_id in disconnecting_peers {
1026
- peer_db. notify_disconnecting ( & peer_id, false ) ;
1026
+ peer_db. notify_disconnecting ( peer_id, false ) ;
1027
1027
self . events . push ( PeerManagerEvent :: DisconnectPeer (
1028
1028
peer_id,
1029
1029
GoodbyeReason :: TooManyPeers ,
Original file line number Diff line number Diff line change @@ -475,10 +475,11 @@ impl<TSpec: EthSpec> PeerDB<TSpec> {
475
475
476
476
/// Notifies the peer manager that the peer is undergoing a normal disconnect. Optionally tag
477
477
/// the peer to be banned after the disconnect.
478
- pub fn notify_disconnecting ( & mut self , peer_id : & PeerId , to_ban_afterwards : bool ) {
479
- if let Some ( info) = self . peers . get_mut ( peer_id) {
480
- info. disconnecting ( to_ban_afterwards) ;
481
- }
478
+ pub fn notify_disconnecting ( & mut self , peer_id : PeerId , to_ban_afterwards : bool ) {
479
+ self . peers
480
+ . entry ( peer_id)
481
+ . or_default ( )
482
+ . disconnecting ( to_ban_afterwards) ;
482
483
}
483
484
484
485
/// Marks a peer to be disconnected and then banned.
You can’t perform that action at this time.
0 commit comments