Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

Commit

Permalink
fix(filter): ignore JoinRequests from filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoga07 committed Jun 18, 2021
1 parent 58bbd51 commit 547625d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ qp2p = "~0.12.0"
rand = "~0.7.3"
rand_chacha = "~0.2.2"
resource_proof = "0.8.0"
sn_messaging = "37.0.0"
sn_messaging = "37.1.0"
sn_data_types = "~0.18.3"
thiserror = "1.0.23"
tokio = "1.3.0"
Expand Down
9 changes: 6 additions & 3 deletions src/routing/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use secured_linked_list::SecuredLinkedList;
use sn_messaging::node::SignatureAggregator;
use sn_messaging::{
node::{Network, Proposal, RoutingMsg, Section, SectionSigned, Variant},
DestInfo, DstLocation, MessageId, SectionAuthorityProvider,
DestInfo, DstLocation, MessageId, SectionAuthorityProvider, WireMsg,
};
use std::collections::BTreeSet;
use tokio::sync::mpsc;
Expand Down Expand Up @@ -92,8 +92,11 @@ impl Core {
// Miscellaneous
////////////////////////////////////////////////////////////////////////////

pub async fn add_to_filter(&mut self, msg_id: &MessageId) -> bool {
self.msg_filter.add_to_filter(msg_id).await
pub async fn add_to_filter(&mut self, wire_msg: &WireMsg) -> bool {
if let Ok(true) = wire_msg.is_join_request() {
return true;
}
self.msg_filter.add_to_filter(&wire_msg.msg_id()).await
}

async fn check_for_entropy(
Expand Down
2 changes: 1 addition & 1 deletion src/routing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ async fn handle_message(dispatcher: Arc<Dispatcher>, bytes: Bytes, sender: Socke
let span = {
let mut state = dispatcher.core.write().await;

if !state.add_to_filter(&wire_msg.msg_id()).await {
if !state.add_to_filter(&wire_msg).await {
trace!(
"not handling message - already handled: {:?}",
wire_msg.msg_id()
Expand Down

0 comments on commit 547625d

Please sign in to comment.