Skip to content

Commit

Permalink
Add details of left handshake message to logging.
Browse files Browse the repository at this point in the history
Signed-off-by: Achim Kraus <achim.kraus@cloudcoap.net>
  • Loading branch information
boaks committed Dec 24, 2023
1 parent 4739c73 commit e0e3184
Showing 1 changed file with 10 additions and 4 deletions.
Expand Up @@ -834,15 +834,21 @@ private void processNextMessages(Record record) throws HandshakeException {
}
} else {
throw new HandshakeException(
String.format("Received unexpected message type [%s] from peer %s",
messageToProcess.getContentType(), peerToLog),
String.format("Received unexpected message type [%s], epoch %d from peer %s",
messageToProcess.getContentType(), recordToProcess.getEpoch(), peerToLog),
new AlertMessage(AlertLevel.FATAL, AlertDescription.HANDSHAKE_FAILURE));
}
recordToProcess = inboundMessageBuffer.getNextRecord();
if (epoch < context.getReadEpoch()) {
if (recordToProcess != null || !inboundMessageBuffer.isEmpty()) {
if (recordToProcess == null && !inboundMessageBuffer.isEmpty()) {
recordToProcess = inboundMessageBuffer.queue.first();
}
if (recordToProcess != null) {
HandshakeMessage left = (HandshakeMessage) recordToProcess.getFragment();
throw new HandshakeException(
String.format("Unexpected handshake message left from peer %s", peerToLog),
String.format("Unexpected %s handshake message, epoch %d.%d/%d left from peer %s",
left.getMessageType(), recordToProcess.getEpoch(),
recordToProcess.getSequenceNumber(), left.getMessageSeq(), peerToLog),
new AlertMessage(AlertLevel.FATAL, AlertDescription.HANDSHAKE_FAILURE));
}
}
Expand Down

0 comments on commit e0e3184

Please sign in to comment.