Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

Commit

Permalink
Fix: don't ack hop messages in Client state
Browse files Browse the repository at this point in the history
  • Loading branch information
madadam committed Apr 26, 2019
1 parent 3a37a9e commit 9539c05
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/state_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ pub enum State {
Bootstrapping(Bootstrapping),
Client(Client),
JoiningNode(JoiningNode),
// TODO: remove
#[allow(dead_code)]
ProvingNode(ProvingNode),
Node(Node),
Terminated,
Expand Down
2 changes: 1 addition & 1 deletion src/states/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl Client {
return Err(RoutingError::UnknownConnection(pub_id));
}

if let Some(routing_msg) = self.filter_hop_message(hop_msg, pub_id)? {
if let Some(routing_msg) = self.filter_hop_message(hop_msg, pub_id, false)? {
Ok(self.dispatch_routing_message(routing_msg, outbox))
} else {
Ok(Transition::Stay)
Expand Down
3 changes: 2 additions & 1 deletion src/states/common/unapproved.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub trait Unapproved: Bootstrapped {
&mut self,
hop_msg: HopMessage,
pub_id: PublicId,
send_ack: bool,
) -> Result<Option<RoutingMessage>, RoutingError> {
hop_msg.verify(pub_id.signing_public_key())?;

Expand All @@ -34,7 +35,7 @@ pub trait Unapproved: Bootstrapped {

let routing_msg = signed_msg.into_routing_message();
let in_authority = self.in_authority(&routing_msg.dst);
if in_authority {
if in_authority && send_ack {
self.send_ack(&routing_msg, 0);
}

Expand Down
2 changes: 1 addition & 1 deletion src/states/joining_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl JoiningNode {
return Err(RoutingError::UnknownConnection(pub_id));
}

if let Some(routing_msg) = self.filter_hop_message(hop_msg, pub_id)? {
if let Some(routing_msg) = self.filter_hop_message(hop_msg, pub_id, true)? {
Ok(self.dispatch_routing_message(routing_msg))
} else {
Ok(Transition::Stay)
Expand Down
2 changes: 1 addition & 1 deletion src/states/proving_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl ProvingNode {
_ => return Err(RoutingError::UnknownConnection(pub_id)),
}

if let Some(routing_msg) = self.filter_hop_message(hop_msg, pub_id)? {
if let Some(routing_msg) = self.filter_hop_message(hop_msg, pub_id, true)? {
self.dispatch_routing_message(routing_msg, outbox)
} else {
Ok(Transition::Stay)
Expand Down

0 comments on commit 9539c05

Please sign in to comment.