Fixes #4444 - Connection timeout intermittently when using jetty 9.4.25.
Fixed write in doShutdownOutput() by updating the state before the write, so that needsFillInterest() can check whether to also do a write or not. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
5794584aea
commit
d5e962e7d0
|
@ -1284,9 +1284,26 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
|
|||
{
|
||||
// If we still can't flush, but we are not closing the endpoint,
|
||||
// let's just flush the encrypted output in the background.
|
||||
ByteBuffer write = _encryptedOutput;
|
||||
if (BufferUtil.hasContent(write))
|
||||
endPoint.write(Callback.from(Callback.NOOP::succeeded, t -> endPoint.close()), write);
|
||||
ByteBuffer write = null;
|
||||
synchronized (_decryptedEndPoint)
|
||||
{
|
||||
if (BufferUtil.hasContent(_encryptedOutput))
|
||||
{
|
||||
write = _encryptedOutput;
|
||||
_flushState = FlushState.WRITING;
|
||||
}
|
||||
}
|
||||
if (write != null)
|
||||
{
|
||||
endPoint.write(Callback.from(() ->
|
||||
{
|
||||
synchronized (_decryptedEndPoint)
|
||||
{
|
||||
_flushState = FlushState.IDLE;
|
||||
releaseEncryptedOutputBuffer();
|
||||
}
|
||||
}, t -> endPoint.close()), write);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -485,9 +485,6 @@ public class SslConnectionTest
|
|||
server.configureBlocking(false);
|
||||
_manager.accept(server);
|
||||
|
||||
//__startBlocking.set(5);
|
||||
//__blockFor.set(3);
|
||||
|
||||
client.getOutputStream().write("Short".getBytes(StandardCharsets.UTF_8));
|
||||
byte[] buffer = new byte[1024];
|
||||
int len = client.getInputStream().read(buffer);
|
||||
|
@ -515,7 +512,7 @@ public class SslConnectionTest
|
|||
assertTrue(__onIncompleteFlush.get());
|
||||
((TestEP)_lastEndp).getWriteFlusher().completeWrite();
|
||||
len = client.getInputStream().read(buffer);
|
||||
assertThat(len, is(len));
|
||||
assertThat(len, is(-1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue