Issue #4217 - SslConnection DecryptedEndpoint flush eternal busy loop
+ Small cleanup of duplicate if statements Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
e665c8f806
commit
93a5ff0b89
|
@ -692,14 +692,6 @@ public class SslConnection extends AbstractConnection
|
|||
_underFlown = unwrapResultStatus == Status.BUFFER_UNDERFLOW ||
|
||||
unwrapResultStatus == Status.OK && unwrapResult.bytesConsumed() == 0 && unwrapResult.bytesProduced() == 0;
|
||||
|
||||
if (_underFlown)
|
||||
{
|
||||
if (net_filled < 0 && _sslEngine.getUseClientMode())
|
||||
closeInbound();
|
||||
if (net_filled <= 0)
|
||||
return net_filled;
|
||||
}
|
||||
|
||||
switch (unwrapResultStatus)
|
||||
{
|
||||
case CLOSED:
|
||||
|
@ -707,34 +699,24 @@ public class SslConnection extends AbstractConnection
|
|||
switch (handshakeStatus)
|
||||
{
|
||||
case NOT_HANDSHAKING:
|
||||
{
|
||||
// We were not handshaking, so just tell the app we are closed
|
||||
return -1;
|
||||
}
|
||||
case NEED_TASK:
|
||||
{
|
||||
_sslEngine.getDelegatedTask().run();
|
||||
continue;
|
||||
}
|
||||
case NEED_WRAP:
|
||||
{
|
||||
// We need to send some handshake data (probably the close handshake).
|
||||
// We return -1 so that the application can drive the close by flushing
|
||||
// or shutting down the output.
|
||||
return -1;
|
||||
}
|
||||
case NEED_UNWRAP:
|
||||
{
|
||||
// We expected to read more, but we got closed.
|
||||
// Return -1 to indicate to the application to drive the close.
|
||||
return -1;
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
}
|
||||
case BUFFER_OVERFLOW:
|
||||
// It's possible that SSLSession.applicationBufferSize has been expanded
|
||||
// by the SSLEngine implementation. Unwrapping a large encrypted buffer
|
||||
|
@ -762,7 +744,6 @@ public class SslConnection extends AbstractConnection
|
|||
catch (SSLException closeFailure)
|
||||
{
|
||||
Throwable handshakeFailure = new SSLHandshakeException("Abruptly closed by peer");
|
||||
if (closeFailure != null)
|
||||
handshakeFailure.initCause(closeFailure);
|
||||
throw handshakeFailure;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue