Remove connection handling from swap execution

The swap should not be concerned with connection handling. This is
the responsibility of the overall application.

All but the execution-setup NetworkBehaviour are `request-response`
behaviours. These have built-in functionality to automatically emit
a dial attempt in case we are not connected at the time we want to
send a message. We remove all of the manual dialling code from the
swap in favor of this behaviour.

Additionally, we make sure to establish a connection as soon as the
EventLoop gets started. In case we ever loose the connection to Alice,
we try to re-establish it.
This commit is contained in:
Thomas Eizinger 2021-03-18 18:00:02 +11:00
parent 804b34f6b0
commit cde3f0f74a
No known key found for this signature in database
GPG key ID: 651AC83A6C6C8B96
11 changed files with 79 additions and 215 deletions

View file

@ -9,7 +9,6 @@ use get_port::get_port;
use libp2p::core::Multiaddr;
use libp2p::{PeerId, Swarm};
use monero_harness::{image, Monero};
use std::convert::Infallible;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::time::Duration;
@ -78,7 +77,7 @@ impl BobParams {
}
}
pub struct BobEventLoopJoinHandle(JoinHandle<Result<Infallible>>);
pub struct BobEventLoopJoinHandle(JoinHandle<()>);
impl BobEventLoopJoinHandle {
pub fn abort(&self) {