mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-29 17:51:35 +00:00
[multistream-select] Fix panic with V1Lazy
(regression) and more convenient transport boxing. (#1783)
* [multistream-select] Fix panic with V1Lazy and add integration tests. Fixes a panic when using the `V1Lazy` negotiation protocol, a regression introduced in https://github.com/libp2p/rust-libp2p/pull/1484. Thereby adds integration tests for a transport upgrade with both `V1` and `V1Lazy` to the `multistream-select` crate to prevent future regressions. * Cleanup. * Update changelog.
This commit is contained in:
@ -38,7 +38,6 @@ use libp2p_core::{
|
||||
identity,
|
||||
transport::MemoryTransport,
|
||||
multiaddr::{Protocol, Multiaddr, multiaddr},
|
||||
muxing::StreamMuxerBox,
|
||||
upgrade
|
||||
};
|
||||
use libp2p_noise as noise;
|
||||
@ -46,7 +45,7 @@ use libp2p_swarm::Swarm;
|
||||
use libp2p_yamux as yamux;
|
||||
use quickcheck::*;
|
||||
use rand::{Rng, random, thread_rng, rngs::StdRng, SeedableRng};
|
||||
use std::{collections::{HashSet, HashMap}, time::Duration, io, num::NonZeroUsize, u64};
|
||||
use std::{collections::{HashSet, HashMap}, time::Duration, num::NonZeroUsize, u64};
|
||||
use multihash::{wrap, Code, Multihash};
|
||||
|
||||
type TestSwarm = Swarm<Kademlia<MemoryStore>>;
|
||||
@ -62,10 +61,7 @@ fn build_node_with_config(cfg: KademliaConfig) -> (Multiaddr, TestSwarm) {
|
||||
let transport = MemoryTransport::default()
|
||||
.upgrade(upgrade::Version::V1)
|
||||
.authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated())
|
||||
.multiplex(yamux::Config::default())
|
||||
.map(|(p, m), _| (p, StreamMuxerBox::new(m)))
|
||||
.map_err(|e| -> io::Error { panic!("Failed to create transport: {:?}", e); })
|
||||
.boxed();
|
||||
.multiplex(yamux::Config::default());
|
||||
|
||||
let local_id = local_public_key.clone().into_peer_id();
|
||||
let store = MemoryStore::new(local_id.clone());
|
||||
|
Reference in New Issue
Block a user