Add logging to investigate add address race condition

This commit is contained in:
Franck Royer 2020-12-21 10:25:19 +11:00
parent 1a4bd0e2b4
commit 4a4e23038b
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4

View File

@ -69,6 +69,7 @@ impl EventLoopHandle {
/// Dials other party and wait for the connection to be established. /// Dials other party and wait for the connection to be established.
/// Do nothing if we are already connected /// Do nothing if we are already connected
pub async fn dial(&mut self, peer_id: PeerId) -> Result<()> { pub async fn dial(&mut self, peer_id: PeerId) -> Result<()> {
debug!("Attempt to dial Alice {}", peer_id);
let _ = self.dial_alice.send(peer_id).await?; let _ = self.dial_alice.send(peer_id).await?;
std::thread::sleep(std::time::Duration::from_millis(100)); std::thread::sleep(std::time::Duration::from_millis(100));
@ -82,7 +83,7 @@ impl EventLoopHandle {
} }
pub async fn add_address(&mut self, peer_id: PeerId, addr: Multiaddr) -> Result<()> { pub async fn add_address(&mut self, peer_id: PeerId, addr: Multiaddr) -> Result<()> {
debug!("Add address {} for peer id {}", addr, peer_id); debug!("Attempt to add address {} for peer id {}", addr, peer_id);
self.add_address.send((peer_id, addr)).await?; self.add_address.send((peer_id, addr)).await?;
Ok(()) Ok(())
} }