Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ public ByteBuffer getNetworkReadBuffer() {
}

public void read(InboundChannelBuffer buffer) throws SSLException {
currentMode.read(buffer);
Mode modePriorToRead;
do {
modePriorToRead = currentMode;
currentMode.read(buffer);
// If we switched modes we want to read again as there might be unhandled bytes that need to be
// handled by the new mode.
} while (modePriorToRead != currentMode);
}

public boolean readyForApplicationWrites() {
Expand Down Expand Up @@ -365,8 +371,9 @@ public void read(InboundChannelBuffer buffer) throws SSLException {
try {
SSLEngineResult result = unwrap(buffer);
handshakeStatus = result.getHandshakeStatus();
continueUnwrap = result.bytesConsumed() > 0;
handshake();
// If we are done handshaking we should exit the handshake read
continueUnwrap = result.bytesConsumed() > 0 && currentMode.isHandshake();
} catch (SSLException e) {
closingInternal();
throw e;
Expand Down