Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Dec 13, 2023
1 parent 98d3bdd commit 91be151
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion mm2src/mm2_p2p/src/behaviours/peers_exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ impl<'de> Deserialize<'de> for PeerIdSerde {
#[derive(Debug, Clone)]
pub enum PeersExchangeProtocol {
Version1,
Version2,
}

impl AsRef<str> for PeersExchangeProtocol {
fn as_ref(&self) -> &str {
match self {
PeersExchangeProtocol::Version1 => "/peers-exchange/1",
PeersExchangeProtocol::Version2 => "/peers-exchange/2",
}
}
}
Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion mm2src/mm2_p2p/src/behaviours/request_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@ struct PendingRequest {
#[derive(Debug, Clone)]
pub enum Protocol {
Version1,
Version2,
}

impl AsRef<str> for Protocol {
fn as_ref(&self) -> &str {
match self {
Protocol::Version1 => "/request-response/1",
Protocol::Version2 => "/request-response/2",
}
}
}
Expand Down Expand Up @@ -393,7 +395,8 @@ impl From<libp2p::request_response::Event<PeerRequest, PeerResponse>> 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();
Expand Down

0 comments on commit 91be151

Please sign in to comment.