From dc7d0b70e3522d79ba15b9347e07e9bec0f9cacd Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 26 Mar 2019 15:27:54 +1100 Subject: [PATCH] Issue #3481 provisional work around Signed-off-by: Greg Wilkins --- .../org/eclipse/jetty/io/ssl/SslConnection.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 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 bc2431d8ecc..43015f2396b 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 @@ -1096,8 +1096,21 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr close = ishut; } - if (flush) - flush(BufferUtil.EMPTY_BUFFER); // Send the TLS close message. + if (flush && !flush(BufferUtil.EMPTY_BUFFER)) + { + // We failed to flush. Try a few times more after short delay just in case progress can be made + // TODO configure these loops and delays or use writeInterest + int retry = 15; + for (;retry-->0;) + { + Thread.sleep(100); + if (flush(BufferUtil.EMPTY_BUFFER)) + break; + } + // if we still can't flush, we will close + close |= retry==0; + } + if (close) getEndPoint().close(); else