mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-09-30 05:15:41 +00:00
Abort the eventloop if the dialling fails
This commit is contained in:
parent
4e9e186462
commit
b7c3524b4f
@ -7,12 +7,12 @@ use crate::{
|
|||||||
bob::{Behaviour, OutEvent, QuoteRequest, State0, State2},
|
bob::{Behaviour, OutEvent, QuoteRequest, State0, State2},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use anyhow::{anyhow, bail, Result};
|
use anyhow::{anyhow, bail, Context, Result};
|
||||||
use futures::FutureExt;
|
use futures::FutureExt;
|
||||||
use libp2p::{core::Multiaddr, PeerId};
|
use libp2p::{core::Multiaddr, PeerId};
|
||||||
use std::{convert::Infallible, sync::Arc};
|
use std::{convert::Infallible, sync::Arc};
|
||||||
use tokio::sync::mpsc::{Receiver, Sender};
|
use tokio::sync::mpsc::{Receiver, Sender};
|
||||||
use tracing::{debug, error, info, trace};
|
use tracing::{debug, error, trace};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Channels<T> {
|
pub struct Channels<T> {
|
||||||
@ -203,12 +203,8 @@ impl EventLoop {
|
|||||||
trace!("Already connected to Alice at {}", peer_id);
|
trace!("Already connected to Alice at {}", peer_id);
|
||||||
let _ = self.conn_established.send(peer_id).await;
|
let _ = self.conn_established.send(peer_id).await;
|
||||||
} else {
|
} else {
|
||||||
info!("dialing alice: {}", peer_id);
|
debug!("Dialing alice at {}", peer_id);
|
||||||
if let Err(err) = libp2p::Swarm::dial(&mut self.swarm, &peer_id) {
|
libp2p::Swarm::dial(&mut self.swarm, &peer_id).context("failed to dial alice")?;
|
||||||
error!("Could not dial alice: {}", err);
|
|
||||||
// TODO(Franck): If Dial fails then we should report it.
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user