Skip to content

Commit

Permalink
Try race condition fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka committed Nov 12, 2020
1 parent 259ddd7 commit 0675c65
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions client/network/src/protocol/generic_proto/handler/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,25 +550,10 @@ impl ProtocolsHandler for NotifsHandler {
};
},
State::OpenDesired { in_substreams, .. } => {
if in_substreams[num].is_some() {
// If a substream already exists, silently drop the new one.
// Note that we drop the substream, which will send an equivalent to a
// TCP "RST" to the remote and force-close the substream. It might
// seem like an unclean way to get rid of a substream. However, keep
// in mind that it is invalid for the remote to open multiple such
// substreams, and therefore sending a "RST" is the most correct thing
// to do.
return;
}
in_substreams[num] = Some(proto);
},
State::Opening { in_substreams, .. } |
State::Open { in_substreams, .. } => {
if in_substreams[num].is_some() {
// Same remark as above.
return;
}

// We create `handshake_message` on a separate line to be sure
// that the lock is released as soon as possible.
let handshake_message = self.in_protocols[num].1.read().clone();
Expand Down

0 comments on commit 0675c65

Please sign in to comment.