Disable connection-sharing unless FEATURE_CONNECTION_SHARING is defined.
authorFabian Keil <fk@fabiankeil.de>
Sun, 6 Sep 2009 14:15:46 +0000 (14:15 +0000)
committerFabian Keil <fk@fabiankeil.de>
Sun, 6 Sep 2009 14:15:46 +0000 (14:15 +0000)
gateway.c
gateway.h
jcc.c
loadcfg.c

index 1bbb88d..19a2947 100644 (file)
--- a/gateway.c
+++ b/gateway.c
@@ -1,4 +1,4 @@
-const char gateway_rcs[] = "$Id: gateway.c,v 1.58 2009/08/19 15:22:18 fabiankeil Exp $";
+const char gateway_rcs[] = "$Id: gateway.c,v 1.59 2009/09/06 14:09:19 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/gateway.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/gateway.c,v $
@@ -125,7 +125,7 @@ struct socks_reply {
 
 static const char socks_userid[] = "anonymous";
 
 
 static const char socks_userid[] = "anonymous";
 
-#ifdef FEATURE_CONNECTION_KEEP_ALIVE
+#ifdef FEATURE_CONNECTION_SHARING
 
 #define MAX_REUSABLE_CONNECTIONS 100
 static unsigned int keep_alive_timeout = DEFAULT_KEEP_ALIVE_TIMEOUT;
 
 #define MAX_REUSABLE_CONNECTIONS 100
 static unsigned int keep_alive_timeout = DEFAULT_KEEP_ALIVE_TIMEOUT;
@@ -270,8 +270,10 @@ void remember_connection(const struct client_state *csp, const struct forward_sp
 
    privoxy_mutex_unlock(&connection_reuse_mutex);
 }
 
    privoxy_mutex_unlock(&connection_reuse_mutex);
 }
+#endif /* def FEATURE_CONNECTION_SHARING */
 
 
 
 
+#ifdef FEATURE_CONNECTION_KEEP_ALIVE
 /*********************************************************************
  *
  * Function    :  mark_connection_closed
 /*********************************************************************
  *
  * Function    :  mark_connection_closed
@@ -300,8 +302,10 @@ void mark_connection_closed(struct reusable_connection *closed_connection)
    freez(closed_connection->forward_host);
    closed_connection->forward_port = 0;
 }
    freez(closed_connection->forward_host);
    closed_connection->forward_port = 0;
 }
+#endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
 
 
 
 
+#ifdef FEATURE_CONNECTION_SHARING
 /*********************************************************************
  *
  * Function    :  forget_connection
 /*********************************************************************
  *
  * Function    :  forget_connection
@@ -345,8 +349,10 @@ void forget_connection(jb_socket sfd)
 
    privoxy_mutex_unlock(&connection_reuse_mutex);
 }
 
    privoxy_mutex_unlock(&connection_reuse_mutex);
 }
+#endif /* def FEATURE_CONNECTION_SHARING */
 
 
 
 
+#ifdef FEATURE_CONNECTION_KEEP_ALIVE
 /*********************************************************************
  *
  * Function    :  connection_destination_matches
 /*********************************************************************
  *
  * Function    :  connection_destination_matches
@@ -396,8 +402,10 @@ int connection_destination_matches(const struct reusable_connection *connection,
    return (!strcmpic(connection->host, http->host));
 
 }
    return (!strcmpic(connection->host, http->host));
 
 }
+#endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
 
 
 
 
+#ifdef FEATURE_CONNECTION_SHARING
 /*********************************************************************
  *
  * Function    :  close_unusable_connections
 /*********************************************************************
  *
  * Function    :  close_unusable_connections
@@ -579,7 +587,7 @@ void set_keep_alive_timeout(unsigned int timeout)
 {
    keep_alive_timeout = timeout;
 }
 {
    keep_alive_timeout = timeout;
 }
-#endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
+#endif /* def FEATURE_CONNECTION_SHARING */
 
 
 /*********************************************************************
 
 
 /*********************************************************************
@@ -605,7 +613,7 @@ jb_socket forwarded_connect(const struct forward_spec * fwd,
    int dest_port;
    jb_socket sfd = JB_INVALID_SOCKET;
 
    int dest_port;
    jb_socket sfd = JB_INVALID_SOCKET;
 
-#ifdef FEATURE_CONNECTION_KEEP_ALIVE
+#ifdef FEATURE_CONNECTION_SHARING
    if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_SHARING)
       && !(csp->flags & CSP_FLAG_SERVER_SOCKET_TAINTED))
    {
    if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_SHARING)
       && !(csp->flags & CSP_FLAG_SERVER_SOCKET_TAINTED))
    {
@@ -615,7 +623,7 @@ jb_socket forwarded_connect(const struct forward_spec * fwd,
          return sfd;
       }
    }
          return sfd;
       }
    }
-#endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
+#endif /* def FEATURE_CONNECTION_SHARING */
 
    /* Figure out if we need to connect to the web server or a HTTP proxy. */
    if (fwd->forward_host)
 
    /* Figure out if we need to connect to the web server or a HTTP proxy. */
    if (fwd->forward_host)
index 0782257..7e39178 100644 (file)
--- a/gateway.h
+++ b/gateway.h
@@ -1,6 +1,6 @@
 #ifndef GATEWAY_H_INCLUDED
 #define GATEWAY_H_INCLUDED
 #ifndef GATEWAY_H_INCLUDED
 #define GATEWAY_H_INCLUDED
-#define GATEWAY_H_VERSION "$Id: gateway.h,v 1.16 2009/05/16 13:27:20 fabiankeil Exp $"
+#define GATEWAY_H_VERSION "$Id: gateway.h,v 1.17 2009/07/11 14:49:09 fabiankeil Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/gateway.h,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/gateway.h,v $
@@ -48,7 +48,6 @@ struct client_state;
 extern jb_socket forwarded_connect(const struct forward_spec * fwd, 
                                    struct http_request *http, 
                                    struct client_state *csp);
 extern jb_socket forwarded_connect(const struct forward_spec * fwd, 
                                    struct http_request *http, 
                                    struct client_state *csp);
-#ifdef FEATURE_CONNECTION_KEEP_ALIVE
 
 /*
  * Default number of seconds after which an
 
 /*
  * Default number of seconds after which an
@@ -56,18 +55,21 @@ extern jb_socket forwarded_connect(const struct forward_spec * fwd,
  */
 #define DEFAULT_KEEP_ALIVE_TIMEOUT 180
 
  */
 #define DEFAULT_KEEP_ALIVE_TIMEOUT 180
 
+#ifdef FEATURE_CONNECTION_SHARING
 extern void set_keep_alive_timeout(unsigned int timeout);
 extern void initialize_reusable_connections(void);
 extern void forget_connection(jb_socket sfd);
 extern void remember_connection(const struct client_state *csp,
                                 const struct forward_spec *fwd);
 extern int close_unusable_connections(void);
 extern void set_keep_alive_timeout(unsigned int timeout);
 extern void initialize_reusable_connections(void);
 extern void forget_connection(jb_socket sfd);
 extern void remember_connection(const struct client_state *csp,
                                 const struct forward_spec *fwd);
 extern int close_unusable_connections(void);
+#endif /* FEATURE_CONNECTION_SHARING */
+
+#ifdef FEATURE_CONNECTION_KEEP_ALIVE
 extern void mark_connection_closed(struct reusable_connection *closed_connection);
 extern int connection_destination_matches(const struct reusable_connection *connection,
                                           const struct http_request *http,
                                           const struct forward_spec *fwd);
 extern void mark_connection_closed(struct reusable_connection *closed_connection);
 extern int connection_destination_matches(const struct reusable_connection *connection,
                                           const struct http_request *http,
                                           const struct forward_spec *fwd);
-#endif /* FEATURE_CONNECTION_KEEP_ALIVE */
-
+#endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
 
 /*
  * Solaris fix
 
 /*
  * Solaris fix
diff --git a/jcc.c b/jcc.c
index 79c76ab..274124f 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.283 2009/09/05 18:04:37 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.284 2009/09/06 14:07:56 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -1026,6 +1026,7 @@ static int server_response_is_complete(struct client_state *csp,
 }
 
 
 }
 
 
+#ifdef FEATURE_CONNECTION_SHARING
 /*********************************************************************
  *
  * Function    :  wait_for_alive_connections
 /*********************************************************************
  *
  * Function    :  wait_for_alive_connections
@@ -1053,6 +1054,7 @@ static void wait_for_alive_connections(void)
    log_error(LOG_LEVEL_CONNECT, "No connections to wait for left.");
 
 }
    log_error(LOG_LEVEL_CONNECT, "No connections to wait for left.");
 
 }
+#endif /* def FEATURE_CONNECTION_SHARING */
 
 
 /*********************************************************************
 
 
 /*********************************************************************
@@ -2443,7 +2445,9 @@ static void serve(struct client_state *csp)
 #endif /* def AMIGA */
 {
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
 #endif /* def AMIGA */
 {
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
+#ifdef FEATURE_CONNECTION_SHARING
    static int monitor_thread_running = 0;
    static int monitor_thread_running = 0;
+#endif /* def FEATURE_CONNECTION_SHARING */
    int continue_chatting = 0;
    unsigned int latency = 0;
 
    int continue_chatting = 0;
    unsigned int latency = 0;
 
@@ -2513,6 +2517,7 @@ static void serve(struct client_state *csp)
          {
             log_error(LOG_LEVEL_CONNECT,
                "No additional client request received in time.");
          {
             log_error(LOG_LEVEL_CONNECT,
                "No additional client request received in time.");
+#ifdef FEATURE_CONNECTION_SHARING
             if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_SHARING)
                && (socket_is_still_usable(csp->sfd)))
             {
             if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_SHARING)
                && (socket_is_still_usable(csp->sfd)))
             {
@@ -2531,6 +2536,7 @@ static void serve(struct client_state *csp)
                }
                privoxy_mutex_unlock(&connection_reuse_mutex);
             }
                }
                privoxy_mutex_unlock(&connection_reuse_mutex);
             }
+#endif /* def FEATURE_CONNECTION_SHARING */
             break;
          }
       }
             break;
          }
       }
@@ -2549,9 +2555,9 @@ static void serve(struct client_state *csp)
 
    if (csp->sfd != JB_INVALID_SOCKET)
    {
 
    if (csp->sfd != JB_INVALID_SOCKET)
    {
-#ifdef FEATURE_CONNECTION_KEEP_ALIVE
+#ifdef FEATURE_CONNECTION_SHARING
       forget_connection(csp->sfd);
       forget_connection(csp->sfd);
-#endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
+#endif /* def FEATURE_CONNECTION_SHARING */
       close_socket(csp->sfd);
    }
 
       close_socket(csp->sfd);
    }
 
@@ -3301,13 +3307,13 @@ static void listen_loop(void)
 
    config = load_config();
 
 
    config = load_config();
 
-#ifdef FEATURE_CONNECTION_KEEP_ALIVE
+#ifdef FEATURE_CONNECTION_SHARING
    /*
     * XXX: Should be relocated once it no
     * longer needs to emit log messages.
     */
    initialize_reusable_connections();
    /*
     * XXX: Should be relocated once it no
     * longer needs to emit log messages.
     */
    initialize_reusable_connections();
-#endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
+#endif /* def FEATURE_CONNECTION_SHARING */
 
    bfd = bind_port_helper(config);
 
 
    bfd = bind_port_helper(config);
 
index 62b943d..c0417ae 100644 (file)
--- a/loadcfg.c
+++ b/loadcfg.c
@@ -1,4 +1,4 @@
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.103 2009/06/15 20:50:56 fabiankeil Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.104 2009/07/19 10:07:46 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
@@ -500,7 +500,7 @@ struct configuration_spec * load_config(void)
 /* *************************************************************************
  * connection-sharing (0|1)
  * *************************************************************************/
 /* *************************************************************************
  * connection-sharing (0|1)
  * *************************************************************************/
-#ifdef FEATURE_CONNECTION_KEEP_ALIVE
+#ifdef FEATURE_CONNECTION_SHARING
          case hash_connection_sharing :
             if ((*arg != '\0') && (0 != atoi(arg)))
             {
          case hash_connection_sharing :
             if ((*arg != '\0') && (0 != atoi(arg)))
             {
@@ -1321,7 +1321,7 @@ struct configuration_spec * load_config(void)
       }
    }
 
       }
    }
 
-#ifdef FEATURE_CONNECTION_KEEP_ALIVE
+#ifdef FEATURE_CONNECTION_SHARING
    if (config->feature_flags & RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE)
    {
       if (config->multi_threaded)
    if (config->feature_flags & RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE)
    {
       if (config->multi_threaded)
@@ -1349,7 +1349,7 @@ struct configuration_spec * load_config(void)
          "has no effect if keep-alive-timeout isn't set.");
       config->feature_flags &= ~RUNTIME_FEATURE_CONNECTION_SHARING;
    }
          "has no effect if keep-alive-timeout isn't set.");
       config->feature_flags &= ~RUNTIME_FEATURE_CONNECTION_SHARING;
    }
-#endif
+#endif /* def FEATURE_CONNECTION_SHARING */
 
    if (NULL == config->proxy_args)
    {
 
    if (NULL == config->proxy_args)
    {