From: Fabian Keil Date: Sun, 21 Oct 2012 13:00:06 +0000 (+0000) Subject: Keep track of how many requests have been received on a client socket X-Git-Tag: v_3_0_20~220 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=3254283127493f2e00c52ac83029ede2ef1cf581 Keep track of how many requests have been received on a client socket --- diff --git a/jcc.c b/jcc.c index 075f23c0..b95f245f 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.401 2012/10/21 12:58:03 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.402 2012/10/21 12:59:40 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -1301,6 +1301,9 @@ static jb_err receive_client_request(struct client_state *csp) struct list header_list; struct list *headers = &header_list; + /* We don't care if the arriving data is a valid HTTP request or not. */ + csp->requests_received_total++; + http = csp->http; memset(buf, 0, sizeof(buf)); @@ -2664,9 +2667,9 @@ static void serve(struct client_state *csp) if (((csp->flags & CSP_FLAG_PIPELINED_REQUEST_WAITING) != 0) && socket_is_still_alive(csp->cfd)) { - log_error(LOG_LEVEL_CONNECT, "A client request has been " + log_error(LOG_LEVEL_CONNECT, "Client request %d has been " "pipelined on socket %d and the socket is still alive.", - csp->cfd); + csp->requests_received_total+1, csp->cfd); prepare_csp_for_next_request(csp); continue; } @@ -2693,7 +2696,8 @@ static void serve(struct client_state *csp) && socket_is_still_alive(csp->cfd)) { log_error(LOG_LEVEL_CONNECT, - "Client request arrived in time on socket %d.", csp->cfd); + "Client request %u arrived in time on socket %d.", + csp->requests_received_total+1, csp->cfd); prepare_csp_for_next_request(csp); } else @@ -2767,10 +2771,10 @@ static void serve(struct client_state *csp) { log_error(LOG_LEVEL_CONNECT, "Closing client socket %d. " "Keep-alive: %u, Socket alive: %u. Data available: %u. " - "Configuration file change detected: %u.", + "Configuration file change detected: %u. Requests received: %u.", csp->cfd, 0 != (csp->flags & CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE), socket_is_still_alive(csp->cfd), data_is_available(csp->cfd, 0), - config_file_change_detected); + config_file_change_detected, csp->requests_received_total); drain_and_close_socket(csp->cfd); } diff --git a/project.h b/project.h index 62b95032..4d9bc576 100644 --- a/project.h +++ b/project.h @@ -1,7 +1,7 @@ #ifndef PROJECT_H_INCLUDED #define PROJECT_H_INCLUDED /** Version string. */ -#define PROJECT_H_VERSION "$Id: project.h,v 1.188 2012/10/21 12:56:38 fabiankeil Exp $" +#define PROJECT_H_VERSION "$Id: project.h,v 1.189 2012/10/21 12:58:03 fabiankeil Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/project.h,v $ @@ -877,6 +877,9 @@ struct client_state /** socket to talk to client (web browser) */ jb_socket cfd; + /** Number of requests received on the client socket. */ + unsigned int requests_received_total; + /** current connection to the server (may go through a proxy) */ struct reusable_connection server_connection;