summaryrefslogtreecommitdiffstats
path: root/src/swarm/peer/inbound.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/peer/inbound.rs')
-rw-r--r--src/swarm/peer/inbound.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/swarm/peer/inbound.rs b/src/swarm/peer/inbound.rs
index 73cc629..745e646 100644
--- a/src/swarm/peer/inbound.rs
+++ b/src/swarm/peer/inbound.rs
@@ -33,12 +33,12 @@ pub(crate) async fn handle_message(
// A reply to a HELLO from an earlier run of ours (late, or queued in Mycelium while
// we were down) says nothing about now; the peer answers our current HELLO.
- if let transport::ParsedMessage::HelloReply(reply) = &message {
- if reply.run_id != state.run_id {
- state.stats.stale_hello_reply();
- debug!(peer = %peer, "Ignoring a HELLO_REPLY to a HELLO from an earlier run");
- return Ok(());
- }
+ if let transport::ParsedMessage::HelloReply(reply) = &message
+ && reply.run_id != state.run_id
+ {
+ state.stats.stale_hello_reply();
+ debug!(peer = %peer, "Ignoring a HELLO_REPLY to a HELLO from an earlier run");
+ return Ok(());
}
if !admit(state, &peer, &message).await {
@@ -84,10 +84,10 @@ pub(crate) async fn handle_message(
debug!(peer = %peer, "HELLO before we know our swarm; not answering yet");
return Ok(());
};
- if let Some(theirs) = &hello.swarm_id {
- if theirs != &swarm_id {
- bail!("Incompatible swarm at {peer}: ours is {swarm_id}, it claims {theirs}");
- }
+ if let Some(theirs) = &hello.swarm_id
+ && theirs != &swarm_id
+ {
+ bail!("Incompatible swarm at {peer}: ours is {swarm_id}, it claims {theirs}");
}
// A resent HELLO (our reply was lost) or a late copy of one repeats a
// handshake we answered already: it must not reset the session again.