Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
fix(network): give up a peer without log a reason (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroqn authored Aug 14, 2020
1 parent 69c7fa0 commit 7151cd4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/network/src/peer_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,7 @@ impl PeerManager {
attempt.peer.set_connectedness(Connectedness::CanConnect);

if attempt.peer.retry.run_out() {
warn!("give up peer {:?} due to retry run out", attempt.peer.id);
attempt.peer.set_connectedness(Connectedness::Unconnectable);
}

Expand Down Expand Up @@ -1076,7 +1077,10 @@ impl PeerManager {

match kind {
PingTimeout => peer.retry.inc(),
PingUnexpect | Discovery => peer.set_connectedness(Connectedness::Unconnectable), /* Give up this peer */
PingUnexpect | Discovery => {
warn!("give up peer {:?} because of {}", peer.id, kind);
peer.set_connectedness(Connectedness::Unconnectable)
}
}
}

Expand Down

0 comments on commit 7151cd4

Please sign in to comment.