Skip to content

Commit

Permalink
Fixes #4444 - Connection timeout intermittently when using jetty 9.4.25.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
sbordet committed Dec 26, 2019
1 parent ccf04a4 commit 5794584
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java
Expand Up @@ -862,6 +862,11 @@ protected void needsFillInterest()
{
interest = true;
_fillState = FillState.INTERESTED;
if (_flushState == FlushState.IDLE && BufferUtil.hasContent(_encryptedOutput))
{
_flushState = FlushState.WRITING;
write = _encryptedOutput;
}
}
break;

Expand Down Expand Up @@ -1489,19 +1494,23 @@ private final class IncompleteWriteCallback implements Callback, Invocable
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();
Expand All @@ -1520,7 +1529,8 @@ public void failed(final Throwable x)
releaseEncryptedOutputBuffer();

_flushState = FlushState.IDLE;
failFillInterest = _fillState == FillState.WAIT_FOR_FLUSH;
failFillInterest = _fillState == FillState.WAIT_FOR_FLUSH ||
_fillState == FillState.INTERESTED;
if (failFillInterest)
_fillState = FillState.IDLE;
}
Expand Down

0 comments on commit 5794584

Please sign in to comment.