From 2d3c45aab07ab1c1b0717e2c8a61d2ff144554ad Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@fabiankeil.de>
Date: Fri, 18 Sep 2009 18:57:20 +0000
Subject: [PATCH] Don't bother remembering connections that already timed out.

While remembering them is safe as they wouldn't be reused
anyway, it's pointless, causes log noise and temporarily
blocks a socket slot.
---
 jcc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/jcc.c b/jcc.c
index 9795626d..12dc1db1 100644
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.292 2009/09/12 12:37:37 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.293 2009/09/18 18:52:33 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -2555,6 +2555,13 @@ static void serve(struct client_state *csp)
             if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_SHARING)
                && (socket_is_still_usable(csp->sfd)))
             {
+               time_t time_open = time(NULL) - csp->server_connection.timestamp;
+
+               if (csp->server_connection.keep_alive_timeout < time_open + latency)
+               {
+                  break;
+               }
+
                remember_connection(csp, forward_url(csp, csp->http));
                csp->sfd = JB_INVALID_SOCKET;
                close_socket(csp->cfd);
-- 
2.49.0