Refactor Bob's peer-id and identity to be handled on the outside

Doing this in the behaviour is a weird indirection that is not needed.
This commit is contained in:
Daniel Karzel 2021-01-18 20:41:58 +11:00
parent 0c19af9090
commit 67e925fe1f
4 changed files with 39 additions and 63 deletions

View file

@ -131,12 +131,11 @@ impl EventLoop {
pub fn new(
transport: SwapTransport,
behaviour: Behaviour,
peer_id: PeerId,
alice_peer_id: PeerId,
alice_addr: Multiaddr,
) -> Result<(Self, EventLoopHandle)> {
let local_peer_id = behaviour.peer_id();
let mut swarm = libp2p::swarm::SwarmBuilder::new(transport, behaviour, local_peer_id)
let mut swarm = libp2p::swarm::SwarmBuilder::new(transport, behaviour, peer_id)
.executor(Box::new(TokioExecutor {
handle: tokio::runtime::Handle::current(),
}))