Skip to content

Commit

Permalink
logs: improve broken handshake info
Browse files Browse the repository at this point in the history
Signed-off-by: ljedrz <[email protected]>
  • Loading branch information
ljedrz committed Apr 5, 2023
1 parent df313dc commit 545efbb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion node/router/src/handshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,18 @@ macro_rules! expect_message {
return Err(error(format!("'{}' disconnected: {reason:?}", $peer_addr)))
}
// Received an unexpected message, abort.
_ => return Err(error(format!("'{}' did not follow the handshake protocol", $peer_addr))),
Some(ty) => {
return Err(error(format!(
"'{}' did not follow the handshake protocol: received {:?} instead of {}",
$peer_addr,
ty.name(),
stringify!($msg_ty),
)))
}
// Received nothing.
None => {
return Err(error(format!("'{}' disconnected before sending {:?}", $peer_addr, stringify!($msg_ty),)))
}
}
};
}
Expand Down

0 comments on commit 545efbb

Please sign in to comment.