repo: updated everything to merged stuff

This commit is contained in:
aggstam
2023-06-29 16:13:43 +03:00
parent b4d28da805
commit 1ea8adfb28
16 changed files with 41 additions and 70 deletions

View File

@@ -142,10 +142,7 @@ impl Dht {
Some(_) => {
debug!(target: "dht", "Key removed: {}", key);
let request = LookupRequest::new(self.id, key, 1);
if let Err(e) = self.p2p.broadcast(&request).await {
error!(target: "dht", "Failed broadcasting request: {}", e);
return Err(e)
}
self.p2p.broadcast(&request).await;
self.lookup_remove(key, self.id)
}
@@ -225,10 +222,7 @@ impl Dht {
let peer = *peers.iter().last().unwrap();
let request = KeyRequest::new(self.id, peer, key);
// TODO: ask connected peers directly, not broadcast
if let Err(e) = self.p2p.broadcast(request).await {
error!(target: "dht", "Failed broadcasting request: {}", e);
return Err(e)
}
self.p2p.broadcast(&request).await;
Ok(())
}

View File

@@ -55,7 +55,7 @@ impl Protocol {
p2p: P2pPtr,
) -> Result<ProtocolBasePtr> {
debug!(target: "dht::protocol", "Adding Protocol to the protocol registry");
let msg_subsystem = channel.get_message_subsystem();
let msg_subsystem = channel.message_subsystem();
msg_subsystem.add_dispatch::<KeyRequest>().await;
msg_subsystem.add_dispatch::<KeyResponse>().await;
msg_subsystem.add_dispatch::<LookupRequest>().await;

View File

@@ -30,6 +30,9 @@ pub mod consensus;
#[cfg(feature = "blockchain")]
pub mod validator;
#[cfg(feature = "dht")]
pub mod dht;
#[cfg(feature = "dht")]
pub mod dht2;