From 91be1514cf963baa50bf8488a310ac39f7e60428 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Wed, 13 Dec 2023 17:15:15 +0300 Subject: [PATCH] test Signed-off-by: onur-ozkan --- mm2src/mm2_p2p/src/behaviours/peers_exchange.rs | 5 ++++- mm2src/mm2_p2p/src/behaviours/request_response.rs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mm2src/mm2_p2p/src/behaviours/peers_exchange.rs b/mm2src/mm2_p2p/src/behaviours/peers_exchange.rs index 38f3b35dc85..52007a335c1 100644 --- a/mm2src/mm2_p2p/src/behaviours/peers_exchange.rs +++ b/mm2src/mm2_p2p/src/behaviours/peers_exchange.rs @@ -49,12 +49,14 @@ impl<'de> Deserialize<'de> for PeerIdSerde { #[derive(Debug, Clone)] pub enum PeersExchangeProtocol { Version1, + Version2, } impl AsRef for PeersExchangeProtocol { fn as_ref(&self) -> &str { match self { PeersExchangeProtocol::Version1 => "/peers-exchange/1", + PeersExchangeProtocol::Version2 => "/peers-exchange/2", } } } @@ -205,7 +207,8 @@ impl NetworkBehaviour for PeersExchange { #[allow(clippy::new_without_default)] impl PeersExchange { pub fn new(network_info: NetworkInfo) -> Self { - let protocol = iter::once((PeersExchangeProtocol::Version1, ProtocolSupport::Full)); + // We don't want to support V1 since it was only used in 7777 old layer. + let protocol = iter::once((PeersExchangeProtocol::Version2, ProtocolSupport::Full)); let config = RequestResponseConfig::default(); let request_response = RequestResponse::new(protocol, config); PeersExchange { diff --git a/mm2src/mm2_p2p/src/behaviours/request_response.rs b/mm2src/mm2_p2p/src/behaviours/request_response.rs index b3b949cedbd..7051a2d8e6d 100644 --- a/mm2src/mm2_p2p/src/behaviours/request_response.rs +++ b/mm2src/mm2_p2p/src/behaviours/request_response.rs @@ -63,12 +63,14 @@ struct PendingRequest { #[derive(Debug, Clone)] pub enum Protocol { Version1, + Version2, } impl AsRef for Protocol { fn as_ref(&self) -> &str { match self { Protocol::Version1 => "/request-response/1", + Protocol::Version2 => "/request-response/2", } } } @@ -393,7 +395,8 @@ impl From> for Reques /// Build a request-response network behaviour. pub fn build_request_response_behaviour() -> RequestResponseBehaviour { let config = RequestResponseConfig::default(); - let protocol = core::iter::once((Protocol::Version1, ProtocolSupport::Full)); + // We don't want to support V1 since it was only used in 7777 old layer. + let protocol = core::iter::once((Protocol::Version2, ProtocolSupport::Full)); let inner = RequestResponse::new(protocol, config); let (tx, rx) = mpsc::unbounded();