From 0713c17cfa9eb09078fcf497faea282bbfb952a4 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Fri, 18 Dec 2015 15:48:25 +0100 Subject: [PATCH] 484683 - FastCGI request idle timeout is handled incorrectly. Added required calls to notIdle() in request/response events, and fixed the semantic of isOpen(). --- .../fcgi/client/http/HttpChannelOverFCGI.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/http/HttpChannelOverFCGI.java b/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/http/HttpChannelOverFCGI.java index fb47ec7ef4c..3704ce80b3f 100644 --- a/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/http/HttpChannelOverFCGI.java +++ b/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/http/HttpChannelOverFCGI.java @@ -79,6 +79,7 @@ public class HttpChannelOverFCGI extends HttpChannel if (exchange != null) { version = exchange.getRequest().getVersion(); + idle.onOpen(); sender.send(exchange); } } @@ -91,6 +92,7 @@ public class HttpChannelOverFCGI extends HttpChannel protected boolean responseBegin(int code, String reason) { + idle.notIdle(); HttpExchange exchange = getHttpExchange(); if (exchange == null) return false; @@ -106,12 +108,14 @@ public class HttpChannelOverFCGI extends HttpChannel protected boolean responseHeaders() { + idle.notIdle(); HttpExchange exchange = getHttpExchange(); return exchange != null && receiver.responseHeaders(exchange); } protected boolean content(ByteBuffer buffer, Callback callback) { + idle.notIdle(); HttpExchange exchange = getHttpExchange(); if (exchange != null) return receiver.responseContent(exchange, buffer, callback); @@ -151,6 +155,7 @@ public class HttpChannelOverFCGI extends HttpChannel private class FCGIIdleTimeout extends IdleTimeout { private final HttpConnectionOverFCGI connection; + private boolean open; public FCGIIdleTimeout(HttpConnectionOverFCGI connection, long idleTimeout) { @@ -159,6 +164,21 @@ public class HttpChannelOverFCGI extends HttpChannel setIdleTimeout(idleTimeout); } + @Override + public void onOpen() + { + open = true; + notIdle(); + super.onOpen(); + } + + @Override + public void onClose() + { + super.onClose(); + open = false; + } + @Override protected void onIdleExpired(TimeoutException timeout) { @@ -170,7 +190,7 @@ public class HttpChannelOverFCGI extends HttpChannel @Override public boolean isOpen() { - return connection.getEndPoint().isOpen(); + return open; } } }