From 485e561d78b2e12a8b1e19ddab2db2361b037494 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 23 Mar 2021 20:38:44 +1100 Subject: [PATCH] Fix #6082 Reduce SSL buffer compaction Only continue if compact creates more space Signed-off-by: Greg Wilkins --- .../main/java/org/eclipse/jetty/io/ssl/SslConnection.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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 77a708884c50..8a047170acbb 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 @@ -711,12 +711,9 @@ public int fill(ByteBuffer buffer) throws IOException return filled = -1; case BUFFER_UNDERFLOW: - // Can we compact? - if (_encryptedInput.position() != 0) - { - BufferUtil.compact(_encryptedInput); + // Continue if we can compact? + if (BufferUtil.compact(_encryptedInput)) continue; - } // Are we out of space? if (BufferUtil.space(_encryptedInput) == 0)