network-devp2p: handle UselessPeer disconnect (#8686)
This commit is contained in:
parent
ec9c6e9783
commit
68d16b723a
@ -686,14 +686,17 @@ impl Host {
|
|||||||
Err(e) => {
|
Err(e) => {
|
||||||
let s = session.lock();
|
let s = session.lock();
|
||||||
trace!(target: "network", "Session read error: {}:{:?} ({:?}) {:?}", token, s.id(), s.remote_addr(), e);
|
trace!(target: "network", "Session read error: {}:{:?} ({:?}) {:?}", token, s.id(), s.remote_addr(), e);
|
||||||
if let ErrorKind::Disconnect(DisconnectReason::IncompatibleProtocol) = *e.kind() {
|
match *e.kind() {
|
||||||
if let Some(id) = s.id() {
|
ErrorKind::Disconnect(DisconnectReason::IncompatibleProtocol) | ErrorKind::Disconnect(DisconnectReason::UselessPeer) => {
|
||||||
if !self.reserved_nodes.read().contains(id) {
|
if let Some(id) = s.id() {
|
||||||
let mut nodes = self.nodes.write();
|
if !self.reserved_nodes.read().contains(id) {
|
||||||
nodes.note_failure(&id);
|
let mut nodes = self.nodes.write();
|
||||||
nodes.mark_as_useless(id);
|
nodes.note_failure(&id);
|
||||||
|
nodes.mark_as_useless(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
_ => {},
|
||||||
}
|
}
|
||||||
kill = true;
|
kill = true;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user