Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix/bootstrap: dont reject BootstrapRequest messages invalidly.
Checking for presence in dropped_clients prevents clients from reconnecting to the proxy until DROPPED_CLIENT_TIMEOUT_SECS
  • Loading branch information
Viv-Rajkumar committed Aug 6, 2017
1 parent e9c45cf commit 442b00d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/states/node.rs
Expand Up @@ -803,20 +803,17 @@ impl Node {
direct_message: &DirectMessage,
pub_id: &PublicId,
) -> Result<(), RoutingError> {
if self.dropped_clients.contains_key(pub_id) {
return Err(RoutingError::ClientConnectionNotFound);
}

match self.peer_mgr.get_peer(pub_id).map(Peer::state) {
Some(&PeerState::Bootstrapper { .. }) => {
if let DirectMessage::BootstrapRequest(_) = *direct_message {
return Ok(());
}
}
Some(&PeerState::Client { .. }) |
None => (),
Some(&PeerState::Client { .. }) => (),
None => return Err(RoutingError::ClientConnectionNotFound),
_ => return Ok(()),
}

debug!(
"{:?} Illegitimate direct message {:?} from {:?}.",
self,
Expand Down

0 comments on commit 442b00d

Please sign in to comment.