mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-04-25 19:02:13 +00:00
Fix the identify test multiplexer (#952)
This commit is contained in:
parent
43e4d1f589
commit
e2f99efb30
@ -221,8 +221,7 @@ pub enum IdentifyEvent {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use crate::{Identify, IdentifyEvent};
|
use crate::{Identify, IdentifyEvent};
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use libp2p_core::{upgrade, upgrade::OutboundUpgradeExt, Swarm, Transport};
|
use libp2p_core::{upgrade, upgrade::OutboundUpgradeExt, upgrade::InboundUpgradeExt, Swarm, Transport};
|
||||||
use libp2p_core::muxing::StreamMuxerBox;
|
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -238,12 +237,13 @@ mod tests {
|
|||||||
let local_peer_id = node1_public_key.clone().into_peer_id();
|
let local_peer_id = node1_public_key.clone().into_peer_id();
|
||||||
let transport = libp2p_tcp::TcpConfig::new()
|
let transport = libp2p_tcp::TcpConfig::new()
|
||||||
.with_upgrade(libp2p_secio::SecioConfig::new(node1_key))
|
.with_upgrade(libp2p_secio::SecioConfig::new(node1_key))
|
||||||
.and_then(move |out, _| {
|
.and_then(move |out, endpoint| {
|
||||||
let peer_id = out.remote_key.into_peer_id();
|
let peer_id = out.remote_key.into_peer_id();
|
||||||
let upgrade =
|
let peer_id2 = peer_id.clone();
|
||||||
libp2p_mplex::MplexConfig::new().map_outbound(move |muxer| (peer_id, muxer));
|
let upgrade = libp2p_mplex::MplexConfig::default()
|
||||||
upgrade::apply_outbound(out.stream, upgrade)
|
.map_outbound(move |muxer| (peer_id, muxer))
|
||||||
.map(|(id, muxer)| (id, StreamMuxerBox::new(muxer)))
|
.map_inbound(move |muxer| (peer_id2, muxer));
|
||||||
|
upgrade::apply(out.stream, upgrade, endpoint)
|
||||||
})
|
})
|
||||||
.map_err(|_| -> io::Error { panic!() });
|
.map_err(|_| -> io::Error { panic!() });
|
||||||
|
|
||||||
@ -256,12 +256,13 @@ mod tests {
|
|||||||
let local_peer_id = node2_public_key.clone().into_peer_id();
|
let local_peer_id = node2_public_key.clone().into_peer_id();
|
||||||
let transport = libp2p_tcp::TcpConfig::new()
|
let transport = libp2p_tcp::TcpConfig::new()
|
||||||
.with_upgrade(libp2p_secio::SecioConfig::new(node2_key))
|
.with_upgrade(libp2p_secio::SecioConfig::new(node2_key))
|
||||||
.and_then(move |out, _| {
|
.and_then(move |out, endpoint| {
|
||||||
let peer_id = out.remote_key.into_peer_id();
|
let peer_id = out.remote_key.into_peer_id();
|
||||||
let upgrade =
|
let peer_id2 = peer_id.clone();
|
||||||
libp2p_mplex::MplexConfig::new().map_outbound(move |muxer| (peer_id, muxer));
|
let upgrade = libp2p_mplex::MplexConfig::default()
|
||||||
upgrade::apply_outbound(out.stream, upgrade)
|
.map_outbound(move |muxer| (peer_id, muxer))
|
||||||
.map(|(id, muxer)| (id, StreamMuxerBox::new(muxer)))
|
.map_inbound(move |muxer| (peer_id2, muxer));
|
||||||
|
upgrade::apply(out.stream, upgrade, endpoint)
|
||||||
})
|
})
|
||||||
.map_err(|_| -> io::Error { panic!() });
|
.map_err(|_| -> io::Error { panic!() });
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user