From: Fabian Keil Date: Wed, 25 Mar 2009 17:30:30 +0000 (+0000) Subject: In serve(), keep the client socket open until we marked the X-Git-Tag: v_3_0_13~145 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=554c1b63903821d0ce15fe1f75f6361475dc4f6f In serve(), keep the client socket open until we marked the server socket as unused. This should increase the chances that we reuse the connection for the client's next request to the same destination. --- diff --git a/ChangeLog b/ChangeLog index 6b97ba8c..f65f7808 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,13 @@ -------------------------------------------------------------------- ChangeLog for Privoxy -------------------------------------------------------------------- +*** Version 3.0.13 (UNRELEASED) *** + +- The client socket is kept open until the server socket has + been marked as unused. This should increase the chances that + the still-open connection will be reused for the client's next + request to the same destination. + *** Version 3.0.12 *** - The socket-timeout option now also works on platforms whose diff --git a/jcc.c b/jcc.c index d0c7d42e..137b572d 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.234 2009/03/18 20:48:42 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.235 2009/03/18 21:01:20 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -33,6 +33,9 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.234 2009/03/18 20:48:42 fabiankeil Exp $" * * Revisions : * $Log: jcc.c,v $ + * Revision 1.235 2009/03/18 21:01:20 fabiankeil + * Comment fix. Spotted by Roland. + * * Revision 1.234 2009/03/18 20:48:42 fabiankeil * If the --no-daemon option is used, enable LOG_LEVEL_INFO * before the config file has been parsed (as we always did). @@ -3339,7 +3342,8 @@ static void chat(struct client_state *csp) * Function : serve * * Description : This is little more than chat. We only "serve" to - * to close any socket that chat may have opened. + * to close (or remember) any socket that chat may have + * opened. * * Parameters : * 1 : csp = Current client state (buffers, headers, etc...) @@ -3354,7 +3358,6 @@ static void serve(struct client_state *csp) #endif /* def AMIGA */ { chat(csp); - close_socket(csp->cfd); if (csp->sfd != JB_INVALID_SOCKET) { @@ -3365,6 +3368,8 @@ static void serve(struct client_state *csp) && (csp->flags & CSP_FLAG_SERVER_CONNECTION_KEEP_ALIVE)) { remember_connection(csp->sfd, csp->http, forward_url(csp, csp->http)); + close_socket(csp->cfd); + csp->cfd = JB_INVALID_SOCKET; privoxy_mutex_lock(&connection_reuse_mutex); if (!monitor_thread_running) { @@ -3386,6 +3391,11 @@ static void serve(struct client_state *csp) #endif /* def FEATURE_CONNECTION_KEEP_ALIVE */ } + if (csp->cfd != JB_INVALID_SOCKET) + { + close_socket(csp->cfd); + } + csp->flags &= ~CSP_FLAG_ACTIVE; }