Restart event loop in tests

Alice was attempting to create a new event loop using the same listen addr as the old one which was still running. This commit aborts the event loop before creating a new one.
This commit is contained in:
rishflab 2021-01-22 13:33:31 +11:00 committed by Franck Royer
parent 77fc5743a2
commit 1597f5336b
No known key found for this signature in database
GPG key ID: A82ED75A8DFC50A4
11 changed files with 63 additions and 48 deletions

View file

@ -96,8 +96,7 @@ async fn main() -> Result<()> {
Arc::new(monero_wallet),
db_path,
listen_addr,
)
.await;
);
let (swap, mut event_loop) =
alice_factory.with_init_params(swap_amounts).build().await?;
@ -185,8 +184,7 @@ async fn main() -> Result<()> {
Arc::new(monero_wallet),
db_path,
listen_addr,
)
.await;
);
let (swap, mut event_loop) = alice_factory.build().await?;
tokio::spawn(async move { event_loop.run().await });

View file

@ -75,7 +75,7 @@ enum InitParams {
}
impl Builder {
pub async fn new(
pub fn new(
seed: Seed,
config: Config,
swap_id: Uuid,
@ -210,7 +210,7 @@ impl Builder {
EventLoop::new(
alice_transport,
alice_behaviour,
self.listen_address.clone(),
self.listen_address(),
self.peer_id,
)
}