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 ||
|
_underFlown = unwrapResultStatus == Status.BUFFER_UNDERFLOW ||
|
||||||
unwrapResultStatus == Status.OK && unwrapResult.bytesConsumed() == 0 && unwrapResult.bytesProduced() == 0;
|
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)
|
switch (unwrapResultStatus)
|
||||||
{
|
{
|
||||||
case CLOSED:
|
case CLOSED:
|
||||||
|
@ -707,32 +699,22 @@ public class SslConnection extends AbstractConnection
|
||||||
switch (handshakeStatus)
|
switch (handshakeStatus)
|
||||||
{
|
{
|
||||||
case NOT_HANDSHAKING:
|
case NOT_HANDSHAKING:
|
||||||
{
|
|
||||||
// We were not handshaking, so just tell the app we are closed
|
// We were not handshaking, so just tell the app we are closed
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
case NEED_TASK:
|
case NEED_TASK:
|
||||||
{
|
|
||||||
_sslEngine.getDelegatedTask().run();
|
_sslEngine.getDelegatedTask().run();
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
case NEED_WRAP:
|
case NEED_WRAP:
|
||||||
{
|
|
||||||
// We need to send some handshake data (probably the close handshake).
|
// We need to send some handshake data (probably the close handshake).
|
||||||
// We return -1 so that the application can drive the close by flushing
|
// We return -1 so that the application can drive the close by flushing
|
||||||
// or shutting down the output.
|
// or shutting down the output.
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
case NEED_UNWRAP:
|
case NEED_UNWRAP:
|
||||||
{
|
|
||||||
// We expected to read more, but we got closed.
|
// We expected to read more, but we got closed.
|
||||||
// Return -1 to indicate to the application to drive the close.
|
// Return -1 to indicate to the application to drive the close.
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case BUFFER_OVERFLOW:
|
case BUFFER_OVERFLOW:
|
||||||
|
@ -762,8 +744,7 @@ public class SslConnection extends AbstractConnection
|
||||||
catch (SSLException closeFailure)
|
catch (SSLException closeFailure)
|
||||||
{
|
{
|
||||||
Throwable handshakeFailure = new SSLHandshakeException("Abruptly closed by peer");
|
Throwable handshakeFailure = new SSLHandshakeException("Abruptly closed by peer");
|
||||||
if (closeFailure != null)
|
handshakeFailure.initCause(closeFailure);
|
||||||
handshakeFailure.initCause(closeFailure);
|
|
||||||
throw handshakeFailure;
|
throw handshakeFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue