Skip to content

Commit

Permalink
kad: Call peers directly
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandru Vasile <[email protected]>
  • Loading branch information
lexnv committed Apr 18, 2024
1 parent 200a0fd commit db5d9ef
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/protocol/libp2p/kademlia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ impl Kademlia {

if let Some(peers) = peers {
// Put the record to the specified peers.
let peers: VecDeque<_> = peers.into_iter().filter_map(|peer| {
let peers = peers.into_iter().filter_map(|peer| {
match self.routing_table.entry(Key::from(peer)) {
// The routing table contains information about the peer address when:
// - Occupied: Established connection
Expand All @@ -755,11 +755,9 @@ impl Kademlia {
}
}).collect();

self.engine.start_put_record(
query_id,
record,
peers
);
if let Err(error) = self.on_query_action(QueryAction::PutRecordToFoundNodes { record, peers }).await {
tracing::debug!(target: LOG_TARGET, ?error, "failed to put record to predefined peers");
}
} else {
self.store.put(record.clone());

Expand Down

0 comments on commit db5d9ef

Please sign in to comment.