-
Notifications
You must be signed in to change notification settings - Fork 81
feat: use message_id instead of hash for message_filter #2527
Conversation
incoming: LruCache<MessageHash, ()>, | ||
outgoing: LruCache<(MessageHash, XorName), ()>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened to filtering outgoing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as each WireMsg will be given a random msg_id, there is no point to filtering outgoing (based on random msg_id).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we filter outgoing previously and if there was a valid reason are we now creating an issue? Or was it always useless?
@@ -466,10 +466,29 @@ async fn handle_message(dispatcher: Arc<Dispatcher>, bytes: Bytes, sender: Socke | |||
}; | |||
let _span_guard = span.enter(); | |||
|
|||
let message_type = match WireMsg::deserialize(bytes) { | |||
let wire_msg = match WireMsg::from(bytes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we deserialising the whole message here as the point is not to and just read dst an dif it's us then process it (deserialise) or forward it.
Also msg_id to be read from msg without deserializing the whole message and added to filter / checked we have handled it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WireMsg::from
only restore the header part, which contains the msg_id
WireMsg::deserialize
or WireMsg::to_message
will deserialize the whole message
src/routing/dispatcher.rs
Outdated
pub async fn contains_incoming(&self, msg_id: &MessageId) -> bool { | ||
self.core.lock().await.contains_incoming(msg_id) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly better to have add_to_filter() ->bool
if added then cool, if not added then drop message (it's filtered)
if self.msg_filter.contains_incoming(&msg) { | ||
trace!("not handling message - already handled: {:?}", msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not still be the case?
0029086
to
68859ab
Compare
- removes hashing here
No description provided.