From 5d8157f124797e48de72ebab4cd74d2c40bccdd8 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 23 Oct 2011 11:24:33 +0000 Subject: [PATCH] If only the server connection is kept alive, do not pretent to wait for a new client request. --- jcc.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/jcc.c b/jcc.c index 8df9d73b..1457206b 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.369 2011/10/23 11:22:16 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.370 2011/10/23 11:23:35 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -2544,22 +2544,24 @@ static void serve(struct client_state *csp) if (continue_chatting) { - unsigned int client_timeout; + unsigned int client_timeout = 1; /* XXX: Use something else here? */ - if (csp->server_connection.sfd != JB_INVALID_SOCKET) + if (0 != (csp->flags & CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE)) { - client_timeout = (unsigned)csp->server_connection.keep_alive_timeout - latency; - log_error(LOG_LEVEL_CONNECT, - "Waiting for the next client request on socket %d. " - "Keeping the server socket %d to %s open.", - csp->cfd, csp->server_connection.sfd, csp->server_connection.host); - } - else - { - client_timeout = 1; /* XXX: Use something else here? */ - log_error(LOG_LEVEL_CONNECT, - "Waiting for the next client request on socket %d. " - "No server socket to keep open.", csp->cfd); + if (csp->server_connection.sfd != JB_INVALID_SOCKET) + { + client_timeout = (unsigned)csp->server_connection.keep_alive_timeout - latency; + log_error(LOG_LEVEL_CONNECT, + "Waiting for the next client request on socket %d. " + "Keeping the server socket %d to %s open.", + csp->cfd, csp->server_connection.sfd, csp->server_connection.host); + } + else + { + log_error(LOG_LEVEL_CONNECT, + "Waiting for the next client request on socket %d. " + "No server socket to keep open.", csp->cfd); + } } if ((csp->flags & CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE) && data_is_available(csp->cfd, (int)client_timeout) @@ -2571,9 +2573,12 @@ static void serve(struct client_state *csp) } else { - log_error(LOG_LEVEL_CONNECT, - "No additional client request received in time on socket %d.", - csp->cfd); + if (0 != (csp->flags & CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE)) + { + log_error(LOG_LEVEL_CONNECT, + "No additional client request received in time on socket %d.", + csp->cfd); + } #ifdef FEATURE_CONNECTION_SHARING if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_SHARING) && (socket_is_still_alive(csp->server_connection.sfd))) -- 2.39.2