Fixes #4444 - Connection timeout intermittently when using jetty 9.4.25.

Fixed handling of encrypted bytes to write in
needsFillInterest() when the TLS handshake status
is NOT_HANDSHAKING.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2019-12-26 18:57:00 +01:00
parent 2551ee758d
commit 65c0a76feb
1 changed files with 13 additions and 3 deletions

View File

@ -842,6 +842,11 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
{
interest = true;
_fillState = FillState.INTERESTED;
if (_flushState == FlushState.IDLE && BufferUtil.hasContent(_encryptedOutput))
{
_flushState = FlushState.WRITING;
write = _encryptedOutput;
}
}
break;
@ -1471,19 +1476,23 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
public void succeeded()
{
boolean fillable;
boolean interested;
synchronized (_decryptedEndPoint)
{
if (LOG.isDebugEnabled())
LOG.debug("IncompleteWriteCB succeeded {}", SslConnection.this);
releaseEncryptedOutputBuffer();
_flushState = FlushState.IDLE;
interested = _fillState == FillState.INTERESTED;
fillable = _fillState == FillState.WAIT_FOR_FLUSH;
if (fillable)
_fillState = FillState.IDLE;
}
if (fillable)
if (interested)
ensureFillInterested();
else if (fillable)
_decryptedEndPoint.getFillInterest().fillable();
_decryptedEndPoint.getWriteFlusher().completeWrite();
@ -1502,7 +1511,8 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
releaseEncryptedOutputBuffer();
_flushState = FlushState.IDLE;
failFillInterest = _fillState == FillState.WAIT_FOR_FLUSH;
failFillInterest = _fillState == FillState.WAIT_FOR_FLUSH ||
_fillState == FillState.INTERESTED;
if (failFillInterest)
_fillState = FillState.IDLE;
}