Skip to content

Commit

Permalink
#8161 remove xml config and improve naming of buffer-releasing methods
Browse files Browse the repository at this point in the history
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
  • Loading branch information
lorban committed Jun 15, 2022
1 parent 090306b commit e6800f7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 70 deletions.
39 changes: 17 additions & 22 deletions jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java
Expand Up @@ -419,7 +419,7 @@ public String toConnectionString()
connection instanceof AbstractConnection ? ((AbstractConnection)connection).toConnectionString() : connection);
}

private void releaseEncryptedInputBuffer()
private void releaseEmptyEncryptedInputBuffer()
{
if (!_lock.isHeldByCurrentThread())
throw new IllegalStateException();
Expand All @@ -430,7 +430,7 @@ private void releaseEncryptedInputBuffer()
}
}

private void releaseDecryptedInputBuffer()
private void releaseEmptyDecryptedInputBuffer()
{
if (!_lock.isHeldByCurrentThread())
throw new IllegalStateException();
Expand All @@ -441,28 +441,23 @@ private void releaseDecryptedInputBuffer()
}
}

private void releaseInputBuffers()
{
clearInputBuffers();
releaseEmptyInputBuffers();
}

private void releaseEmptyInputBuffers()
{
releaseEncryptedInputBuffer();
releaseDecryptedInputBuffer();
}

private void clearInputBuffers()
private void discardInputBuffers()
{
if (!_lock.isHeldByCurrentThread())
throw new IllegalStateException();
if (_encryptedInput != null)
_encryptedInput.clear();
BufferUtil.clear(_decryptedInput);
releaseEmptyInputBuffers();
}

private void releaseEmptyInputBuffers()
{
releaseEmptyEncryptedInputBuffer();
releaseEmptyDecryptedInputBuffer();
}

private void releaseEncryptedOutputBuffer()
private void discardEncryptedOutputBuffer()
{
if (!_lock.isHeldByCurrentThread())
throw new IllegalStateException();
Expand Down Expand Up @@ -792,7 +787,7 @@ public int fill(ByteBuffer buffer) throws IOException
// See also system property "jsse.SSLEngine.acceptLargeFragments".
if (BufferUtil.isEmpty(_decryptedInput) && appBufferSize < getApplicationBufferSize())
{
releaseDecryptedInputBuffer();
releaseEmptyDecryptedInputBuffer();
continue;
}
throw new IllegalStateException("Unexpected unwrap result " + unwrap);
Expand Down Expand Up @@ -823,7 +818,7 @@ public int fill(ByteBuffer buffer) throws IOException
}
catch (Throwable x)
{
releaseInputBuffers();
discardInputBuffers();
Throwable f = handleException(x, "fill");
Throwable failure = handshakeFailed(f);
if (_flushState == FlushState.WAIT_FOR_FILL)
Expand Down Expand Up @@ -1192,7 +1187,7 @@ public boolean flush(ByteBuffer... appOuts) throws IOException
}
catch (Throwable x)
{
releaseEncryptedOutputBuffer();
discardEncryptedOutputBuffer();
Throwable failure = handleException(x, "flush");
throw handshakeFailed(failure);
}
Expand Down Expand Up @@ -1384,7 +1379,7 @@ private void disconnect()
{
try (AutoLock l = _lock.lock())
{
releaseEncryptedOutputBuffer();
discardEncryptedOutputBuffer();
}
getEndPoint().close();
}
Expand Down Expand Up @@ -1433,7 +1428,7 @@ public void doClose()
{
try (AutoLock l = _lock.lock())
{
releaseInputBuffers();
discardInputBuffers();
}
// First send the TLS Close Alert, then the FIN.
doShutdownOutput(true);
Expand Down Expand Up @@ -1615,7 +1610,7 @@ public void failed(final Throwable x)
if (LOG.isDebugEnabled())
LOG.debug("IncompleteWriteCB failed {}", SslConnection.this, x);

releaseEncryptedOutputBuffer();
discardEncryptedOutputBuffer();

_flushState = FlushState.IDLE;
failFillInterest = _fillState == FillState.WAIT_FOR_FLUSH ||
Expand Down

This file was deleted.

31 changes: 0 additions & 31 deletions jetty-server/src/main/config/modules/retainablebytebufferpool.mod

This file was deleted.

0 comments on commit e6800f7

Please sign in to comment.