mturk       2004/12/16 01:49:42

  Modified:    jk/native/common jk_ajp_common.c jk_ajp_common.h
  Log:
  Use zero for default cache timeout value, and properly set the last
  access time value.
  
  Revision  Changes    Path
  1.69      +9 -9      
jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c
  
  Index: jk_ajp_common.c
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- jk_ajp_common.c   16 Dec 2004 08:38:05 -0000      1.68
  +++ jk_ajp_common.c   16 Dec 2004 09:49:41 -0000      1.69
  @@ -1958,14 +1958,13 @@
       if (pThis && pThis->worker_private && je) {
           ajp_worker_t *aw = pThis->worker_private;
           ajp_endpoint_t *ae = NULL;
  +        time_t now = time(NULL);
   
           if (aw->ep_cache_sz) {
               int rc;
               JK_ENTER_CS(&aw->cs, rc);
               if (rc) {
                   unsigned i;
  -                time_t now;
  -                now = time(NULL);
                   for (i = 0; i < aw->ep_cache_sz; i++) {
                       if (aw->ep_cache[i]) {
                           ae = aw->ep_cache[i];
  @@ -1974,9 +1973,10 @@
                       }
                   }
                   /* Handle enpoint cache timeouts */
  -                if (aw->cache_timeout) {
  -                    for (; i < aw->ep_cache_sz; i++) {
  -                        if (aw->ep_cache[i]) {
  +                if (ae && aw->cache_timeout) {
  +                    for (i = 0; i < aw->ep_cache_sz; i++) {
  +                        /* Skip the cached enty */
  +                        if (aw->ep_cache[i] && (ae != aw->ep_cache[i])) {
                               int elapsed =
                                   (int)(now - ae->last_access);
                               if (elapsed > aw->cache_timeout) {
  @@ -1994,7 +1994,6 @@
                       if (ae->sd > 0) {
                           /* Handle timeouts for open sockets */
                           int elapsed = (int)(now - ae->last_access);
  -                        ae->last_access = now;
                           jk_log(l, JK_LOG_DEBUG,
                                  "time elapsed since last request = %u 
seconds\n",
                                  elapsed);
  @@ -2007,18 +2006,19 @@
                               ae->sd = -1;        /* just to avoid twice close 
*/
                           }
                       }
  +                    ae->last_access = now;
                       *je = &ae->endpoint;
                       JK_TRACE_EXIT(l);
                       return JK_TRUE;
                   }
               }
           }
  -
  +        /* Create new endpoint */
           ae = (ajp_endpoint_t *) calloc(1, sizeof(ajp_endpoint_t));
           if (ae) {
               ae->sd = -1;
               ae->reuse = JK_FALSE;
  -            ae->last_access = time(NULL);
  +            ae->last_access = now;
               jk_open_pool(&ae->pool, ae->buf, sizeof(ae->buf));
               ae->worker = pThis->worker_private;
               ae->endpoint.endpoint_private = ae;
  
  
  
  1.27      +2 -2      
jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.h
  
  Index: jk_ajp_common.h
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.h,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- jk_ajp_common.h   10 Nov 2004 16:36:48 -0000      1.26
  +++ jk_ajp_common.h   16 Dec 2004 09:49:42 -0000      1.27
  @@ -188,7 +188,7 @@
   #define AJP_HEADER_LEN            (4)
   #define AJP_HEADER_SZ_LEN         (2)
   #define CHUNK_BUFFER_PAD          (12)
  -#define AJP_DEF_CACHE_TIMEOUT     (15)
  +#define AJP_DEF_CACHE_TIMEOUT     (0)
   #define AJP_DEF_CONNECT_TIMEOUT   (0)   /* NO CONNECTION TIMEOUT => NO 
CPING/CPONG */
   #define AJP_DEF_REPLY_TIMEOUT     (0)   /* NO REPLY TIMEOUT                  
      */
   #define AJP_DEF_PREPOST_TIMEOUT   (0)   /* NO PREPOST TIMEOUT => NO 
CPING/CPONG    */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to