[prev in list] [next in list] [prev in thread] [next in thread] 

List:       privoxy-commits
Subject:    [privoxy-commits] current jcc.c, 1.303, 1.304 loadcfg.c, 1.106,
From:       noreply () sourceforge ! net
Date:       2009-11-27 13:46:49
Message-ID: E1NE19t-0003hZ-Rp () sfp-cvsdas-1 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/ijbswa/current
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv14228

Modified Files:
	jcc.c loadcfg.c project.h 
Log Message:
Add the config option default-server-timeout to control the assumed default server timeout.

Since Privoxy no longer returns an error message for connection
resets on reused client connections, assuming larger server timeout
values appears to actually work pretty well as long as connections
aren't shared.


Index: jcc.c
===================================================================
RCS file: /cvsroot/ijbswa/current/jcc.c,v
retrieving revision 1.303
retrieving revision 1.304
diff -u -d -r1.303 -r1.304
--- jcc.c	29 Oct 2009 16:55:29 -0000	1.303
+++ jcc.c	27 Nov 2009 13:46:47 -0000	1.304
@@ -2518,19 +2518,23 @@
          && !(csp->flags & CSP_FLAG_SERVER_SOCKET_TAINTED)
          && (csp->cfd != JB_INVALID_SOCKET)
          && (csp->server_connection.sfd != JB_INVALID_SOCKET)
-         && socket_is_still_usable(csp->server_connection.sfd)
-         && (latency < csp->server_connection.keep_alive_timeout);
+         && socket_is_still_usable(csp->server_connection.sfd);
 
       if (continue_chatting)
       {
-         unsigned int client_timeout;
-
          if (!(csp->flags & CSP_FLAG_SERVER_KEEP_ALIVE_TIMEOUT_SET))
          {
-            log_error(LOG_LEVEL_CONNECT, "The server didn't specify how long "
-               "the connection will stay open. Assume it's only a second.");
-            csp->server_connection.keep_alive_timeout = 1;
+            csp->server_connection.keep_alive_timeout = csp->config->default_server_timeout;
+            log_error(LOG_LEVEL_CONNECT,
+               "The server didn't specify how long the connection will stay open. "
+               "Assumed timeout is: %u.", csp->server_connection.keep_alive_timeout);
          }
+         continue_chatting = (latency < csp->server_connection.keep_alive_timeout);
+      }
+
+      if (continue_chatting)
+      {
+         unsigned int client_timeout;
 
          client_timeout = (unsigned)csp->server_connection.keep_alive_timeout - latency;
 

Index: loadcfg.c
===================================================================
RCS file: /cvsroot/ijbswa/current/loadcfg.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -r1.106 -r1.107
--- loadcfg.c	10 Sep 2009 14:45:17 -0000	1.106
+++ loadcfg.c	27 Nov 2009 13:46:47 -0000	1.107
@@ -136,6 +136,7 @@
 #define hash_confdir                        1978389ul /* "confdir" */
 #define hash_connection_sharing          1348841265ul /* "connection-sharing" */
 #define hash_debug                            78263ul /* "debug" */
+#define hash_default_server_timeout      2530089913ul /* "default-server-timeout" */
 #define hash_deny_access                 1227333715ul /* "deny-access" */
 #define hash_enable_edit_actions         2517097536ul /* "enable-edit-actions" */
 #define hash_enable_remote_toggle        2979744683ul /* "enable-remote-toggle" */
@@ -358,6 +359,7 @@
    config->max_client_connections    = 0;
    config->socket_timeout            = 300; /* XXX: Should be a macro. */
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
+   config->default_server_timeout    = 0;
    config->keep_alive_timeout        = DEFAULT_KEEP_ALIVE_TIMEOUT;
    config->feature_flags            &= ~RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE;
    config->feature_flags            &= ~RUNTIME_FEATURE_CONNECTION_SHARING;
@@ -522,6 +524,27 @@
             break;
 
 /* *************************************************************************
+ * default-server-timeout timeout
+ * *************************************************************************/
+#ifdef FEATURE_CONNECTION_KEEP_ALIVE
+         case hash_default_server_timeout :
+            if (*arg != '\0')
+            {
+               int timeout = atoi(arg);
+               if (0 < timeout)
+               {
+                  config->default_server_timeout = (unsigned int)timeout;
+               }
+               else
+               {
+                  log_error(LOG_LEVEL_FATAL,
+                     "Invalid default-server-timeout value: %s", arg);
+               }
+            }
+            break;
+#endif
+
+/* *************************************************************************
  * deny-access source-ip[/significant-bits] [dest-ip[/significant-bits]]
  * *************************************************************************/
 #ifdef FEATURE_ACL
@@ -1321,6 +1344,16 @@
       }
    }
 
+#ifdef FEATURE_CONNECTION_KEEP_ALIVE
+   if (config->default_server_timeout > config->keep_alive_timeout)
+   {
+      log_error(LOG_LEVEL_ERROR,
+         "Reducing the default-server-timeout from %d to the keep-alive-timeout %d.",
+         config->default_server_timeout, config->keep_alive_timeout);
+      config->default_server_timeout = config->keep_alive_timeout;
+   }
+#endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
+
 #ifdef FEATURE_CONNECTION_SHARING
    if (config->feature_flags & RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE)
    {

Index: project.h
===================================================================
RCS file: /cvsroot/ijbswa/current/project.h,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -d -r1.152 -r1.153
--- project.h	8 Nov 2009 17:54:09 -0000	1.152
+++ project.h	27 Nov 2009 13:46:47 -0000	1.153
@@ -1257,6 +1257,9 @@
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
    /* Maximum number of seconds after which an open connection will no longer be reused. */
    unsigned int keep_alive_timeout;
+
+   /* Assumed server-side keep alive timeout if none is specified. */
+   unsigned int default_server_timeout;
 #endif
 
    /** All options from the config file, HTML-formatted. */


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
ijbswa-commits mailing list
ijbswa-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ijbswa-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic