fix(disc): only start pinging new node if insert succesful (#1435)

This commit is contained in:
Matthias Seitz
2023-02-17 17:46:05 +01:00
committed by GitHub
parent 4bdbcf346e
commit a0410e46b7

View File

@@ -809,13 +809,18 @@ impl Discv4Service {
match self.kbuckets.entry(&key) {
kbucket::Entry::Absent(entry) => {
let node = NodeEntry::new(record);
let _ = entry.insert(
match entry.insert(
node,
NodeStatus {
direction: ConnectionDirection::Outgoing,
state: ConnectionState::Disconnected,
},
);
) {
BucketInsertResult::Inserted | BucketInsertResult::Pending { .. } => {
debug!(target : "discv4", ?record, "inserted new record");
}
_ => return,
}
}
_ => return,
}