Skip to content

Commit

Permalink
Fix two potential connection poisonings (paritytech#7677)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka authored and darkfriend77 committed Jan 11, 2021
1 parent b3bac76 commit 98aadb9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/network/src/protocol/generic_proto/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,7 @@ impl NetworkBehaviour for GenericProto {
connec_state,
ConnectionState::OpeningThenClosing
));
*entry.into_mut() = PeerState::Disabled { connections, backoff_until };
}
} else {
error!(
Expand Down Expand Up @@ -1652,6 +1653,7 @@ impl NetworkBehaviour for GenericProto {
};

if matches!(connections[pos].1, ConnectionState::Closing) {
*entry.into_mut() = PeerState::Enabled { connections };
return;
}

Expand Down Expand Up @@ -1683,7 +1685,7 @@ impl NetworkBehaviour for GenericProto {
notifications_sink: replacement_sink,
};
self.events.push_back(NetworkBehaviourAction::GenerateEvent(event));
*entry.into_mut() = PeerState::Enabled { connections, };
*entry.into_mut() = PeerState::Enabled { connections };
}

} else {
Expand Down

0 comments on commit 98aadb9

Please sign in to comment.