mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-30 02:01:35 +00:00
refactor(identify): bring tests up to workspace standard
This patch refactors the identify tests to use `libp2p-swarm-test`. This allows us to delete quite a bit of code and makes several dev-dependencies obsolete. The `correct_transfer` test is made obsolete by more precise assertions in the `periodic_identify` test. This allows us to remove the dependency on the `upgrade::{apply_inbound,apply_outbound}` functions. Finally, we also fix a bug where the reported listen addresses to the other node could contain duplicates. Related: #3748. Pull-Request: #3851.
This commit is contained in:
@ -39,7 +39,7 @@ use libp2p_swarm::{
|
||||
};
|
||||
use log::warn;
|
||||
use smallvec::SmallVec;
|
||||
use std::collections::VecDeque;
|
||||
use std::collections::{HashSet, VecDeque};
|
||||
use std::{io, pin::Pin, task::Context, task::Poll, time::Duration};
|
||||
|
||||
/// Protocol handler for sending and receiving identification requests.
|
||||
@ -89,7 +89,7 @@ pub struct Handler {
|
||||
#[derive(Debug)]
|
||||
pub struct InEvent {
|
||||
/// The addresses that the peer is listening on.
|
||||
pub listen_addrs: Vec<Multiaddr>,
|
||||
pub listen_addrs: HashSet<Multiaddr>,
|
||||
|
||||
/// The list of protocols supported by the peer, e.g. `/ipfs/ping/1.0.0`.
|
||||
pub supported_protocols: Vec<StreamProtocol>,
|
||||
@ -246,7 +246,7 @@ impl ConnectionHandler for Handler {
|
||||
public_key: self.public_key.clone(),
|
||||
protocol_version: self.protocol_version.clone(),
|
||||
agent_version: self.agent_version.clone(),
|
||||
listen_addrs,
|
||||
listen_addrs: Vec::from_iter(listen_addrs),
|
||||
protocols: supported_protocols,
|
||||
observed_addr: self.observed_addr.clone(),
|
||||
};
|
||||
|
Reference in New Issue
Block a user