mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
net: Remove channels from P2P if broadcast fails.
This commit is contained in:
@@ -275,7 +275,10 @@ impl P2p {
|
||||
}
|
||||
|
||||
futures.push(channel.send(message).map_err(|e| {
|
||||
format!("P2P: Broadcasting message to {} failed: {}", channel.address(), e)
|
||||
(
|
||||
format!("[P2P] Broadcasting message to {} failed: {}", channel.address(), e),
|
||||
channel.clone(),
|
||||
)
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -285,10 +288,9 @@ impl P2p {
|
||||
}
|
||||
|
||||
while let Some(entry) = futures.next().await {
|
||||
// TODO: Here we can close the channels.
|
||||
// See message_subscriber::_trigger_all on how to do it.
|
||||
if let Err(e) = entry {
|
||||
if let Err((e, chan)) = entry {
|
||||
error!(target: "net::p2p::broadcast()", "{}", e);
|
||||
self.remove(chan).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user