diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java b/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java index 99bcc2a0b777..62214a1f866a 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java @@ -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(); @@ -430,7 +430,7 @@ private void releaseEncryptedInputBuffer() } } - private void releaseDecryptedInputBuffer() + private void releaseEmptyDecryptedInputBuffer() { if (!_lock.isHeldByCurrentThread()) throw new IllegalStateException(); @@ -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(); @@ -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); @@ -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) @@ -1192,7 +1187,7 @@ public boolean flush(ByteBuffer... appOuts) throws IOException } catch (Throwable x) { - releaseEncryptedOutputBuffer(); + discardEncryptedOutputBuffer(); Throwable failure = handleException(x, "flush"); throw handshakeFailed(failure); } @@ -1384,7 +1379,7 @@ private void disconnect() { try (AutoLock l = _lock.lock()) { - releaseEncryptedOutputBuffer(); + discardEncryptedOutputBuffer(); } getEndPoint().close(); } @@ -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); @@ -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 || diff --git a/jetty-server/src/main/config/etc/jetty-retainablebytebufferpool.xml b/jetty-server/src/main/config/etc/jetty-retainablebytebufferpool.xml deleted file mode 100644 index e7ac808f2688..000000000000 --- a/jetty-server/src/main/config/etc/jetty-retainablebytebufferpool.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/jetty-server/src/main/config/modules/retainablebytebufferpool.mod b/jetty-server/src/main/config/modules/retainablebytebufferpool.mod deleted file mode 100644 index 1ce28212706f..000000000000 --- a/jetty-server/src/main/config/modules/retainablebytebufferpool.mod +++ /dev/null @@ -1,31 +0,0 @@ -[description] -Configures the RetainableByteBufferPool used by ServerConnectors. - -[tags] -retainablebytebufferpool - -[xml] -etc/jetty-retainablebytebufferpool.xml - -[ini-template] -## Minimum capacity of a single ByteBuffer. -#jetty.retainableByteBufferPool.minCapacity=0 - -## Maximum capacity of a single ByteBuffer. -## Requests for ByteBuffers larger than this value results -## in the ByteBuffer being allocated but not pooled. -#jetty.retainableByteBufferPool.maxCapacity=65536 - -## Bucket capacity factor. -## ByteBuffers are allocated out of buckets that have -## a capacity that is multiple of this factor. -#jetty.retainableByteBufferPool.factor=1024 - -## Maximum number of ByteBuffers for each bucket. -#jetty.retainableByteBufferPool.maxBucketSize=2147483647 - -## Maximum heap memory bytes retainable by the pool (0 for heuristic, -1 for unlimited). -#jetty.retainableByteBufferPool.maxHeapMemory=0 - -## Maximum direct memory bytes retainable by the pool (0 for heuristic, -1 for unlimited). -#jetty.retainableByteBufferPool.maxDirectMemory=0