Issue #4217 - Fixing OVERFLOW case to allow flush()

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2019-10-30 17:21:59 -05:00
parent c980e3dd34
commit f7ab02a5d1
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
1 changed files with 8 additions and 4 deletions

View File

@ -879,6 +879,9 @@ public class SslConnection extends AbstractConnection
} }
return allConsumed; return allConsumed;
case BUFFER_UNDERFLOW:
throw new IllegalStateException();
case BUFFER_OVERFLOW: case BUFFER_OVERFLOW:
{ {
// It's possible that SSLSession.packetBufferSize has been expanded // It's possible that SSLSession.packetBufferSize has been expanded
@ -892,12 +895,13 @@ public class SslConnection extends AbstractConnection
releaseEncryptedOutputBuffer(); releaseEncryptedOutputBuffer();
continue; 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: default:
if (DEBUG) if (DEBUG)
LOG.debug("{} {} {}", this, wrapResultStatus, BufferUtil.toDetailString(_encryptedOutput)); LOG.debug("{} {} {}", this, wrapResultStatus, BufferUtil.toDetailString(_encryptedOutput));