Skip to content

Commit

Permalink
Issue #4217 - Fixing OVERFLOW case to allow flush()
Browse files Browse the repository at this point in the history
Signed-off-by: Joakim Erdfelt <[email protected]>
  • Loading branch information
joakime committed Oct 30, 2019
1 parent c980e3d commit f7ab02a
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,9 @@ public synchronized boolean flush(ByteBuffer... appOuts) throws IOException
}
return allConsumed;

case BUFFER_UNDERFLOW:
throw new IllegalStateException();

case BUFFER_OVERFLOW:
{
// It's possible that SSLSession.packetBufferSize has been expanded
Expand All @@ -892,12 +895,13 @@ public synchronized boolean flush(ByteBuffer... appOuts) throws IOException
releaseEncryptedOutputBuffer();
continue;
}
throw new IllegalStateException("Unexpected wrap result " + wrapResultStatus);
if (BufferUtil.isEmpty(_encryptedOutput))
{
throw new IllegalStateException("Unexpected wrap result " + wrapResultStatus);
}
// fall-through default case to flush()
}

case BUFFER_UNDERFLOW:
throw new IllegalStateException();

default:
if (DEBUG)
LOG.debug("{} {} {}", this, wrapResultStatus, BufferUtil.toDetailString(_encryptedOutput));
Expand Down

0 comments on commit f7ab02a

Please sign in to comment.