From 2eebf1d9e590ec58fa2eb222e6119e2547230ad6 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 21 Oct 2012 13:04:34 +0000 Subject: [PATCH] Remember connections in case of destination mismatches in chat() ... when configured to share connection. --- jcc.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/jcc.c b/jcc.c index fb675c1f..8f912caf 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.403 2012/10/21 13:00:06 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.404 2012/10/21 13:04:08 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -1698,10 +1698,20 @@ static void chat(struct client_state *csp) { if (csp->server_connection.sfd != JB_INVALID_SOCKET) { - log_error(LOG_LEVEL_CONNECT, - "Closing server socket %u. Opened for %s.", - csp->server_connection.sfd, csp->server_connection.host); - close_socket(csp->server_connection.sfd); +#ifdef FEATURE_CONNECTION_SHARING + if (csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_SHARING) + { + remember_connection(&csp->server_connection); + } + else +#endif /* def FEATURE_CONNECTION_SHARING */ + { + log_error(LOG_LEVEL_CONNECT, + "Closing server socket %d connected to %s. Total requests: %u.", + csp->server_connection.sfd, csp->server_connection.host, + csp->server_connection.requests_sent_total); + close_socket(csp->server_connection.sfd); + } mark_connection_closed(&csp->server_connection); } #endif /* def FEATURE_CONNECTION_KEEP_ALIVE */ -- 2.39.2