You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2008/09/21 11:46:00 UTC

svn commit: r697462 - /tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c

Author: rjung
Date: Sun Sep 21 02:45:59 2008
New Revision: 697462

URL: http://svn.apache.org/viewvc?rev=697462&view=rev
Log:
Let's use "mstarted" introduced in r697451 in all places,
where it makes sense, and "now" mostly where it is now.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c

Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?rev=697462&r1=697461&r2=697462&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Sun Sep 21 02:45:59 2008
@@ -2803,10 +2803,10 @@
     return JK_FALSE;
 }
 
-int JK_METHOD ajp_maintain(jk_worker_t *pThis, time_t now, jk_logger_t *l)
+int JK_METHOD ajp_maintain(jk_worker_t *pThis, time_t mstarted, jk_logger_t *l)
 {
     JK_TRACE_ENTER(l);
-    time_t mstarted = now;
+    time_t now = mstarted;
 
     if (pThis && pThis->worker_private) {
         ajp_worker_t *aw = pThis->worker_private;
@@ -2821,9 +2821,9 @@
          * Since it's possible that we come here a few milliseconds
          * before the interval has passed, we allow a little tolerance.
          */
-        delta = (long)difftime(now, aw->s->last_maintain_time) + JK_AJP_MAINTAIN_TOLERANCE;
+        delta = (long)difftime(mstarted, aw->s->last_maintain_time) + JK_AJP_MAINTAIN_TOLERANCE;
         if (delta >= aw->maintain_time) {
-            aw->s->last_maintain_time = now;
+            aw->s->last_maintain_time = mstarted;
             if (aw->s->state == JK_AJP_STATE_OK &&
                 aw->s->used == aw->s->used_snapshot)
                 aw->s->state = JK_AJP_STATE_IDLE;
@@ -2832,7 +2832,7 @@
 
         jk_shm_unlock();
 
-        /* Obtain current time only if needed */
+        /* Do connection pool maintenance only if timeouts or keepalives are set */
         if (aw->cache_timeout <= 0 &&
             aw->connection_keepalive <= 0) {
             /* Nothing to do. */
@@ -2854,7 +2854,7 @@
                  i >= 0 && aw->cache_timeout > 0; i--) {
                 /* Skip the closed sockets */
                 if (aw->ep_cache[i] && IS_VALID_SOCKET(aw->ep_cache[i]->sd)) {
-                    int elapsed = (int)difftime(now, aw->ep_cache[i]->last_access);
+                    int elapsed = (int)difftime(mstarted, aw->ep_cache[i]->last_access);
                     if (elapsed > aw->cache_timeout) {
                         time_t rt = 0;
                         n++;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r697462 - /tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c

Posted by Rainer Jung <ra...@kippdata.de>.
Fixed. Sorry I broke it, gcc does allow it, and I always forget I
shouldn't do that. Thanks for the information.

Tim Whittington schrieb:
> This fails to build in VC.Net 2005 (actually the change in r697451 is the
> culprit).
> The definition of now/mstarted needs to precede the JK_TRACE_ENTER.
> 
> cheers
> tim
> 
> 
> 
> From: <rj...@apache.org>
> Reply-To: Tomcat Developers List <de...@tomcat.apache.org>
> Date: Sun, 21 Sep 2008 09:46:00 -0000
> To: <de...@tomcat.apache.org>
> Subject: svn commit: r697462 -
> /tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
> 
> Author: rjung
> Date: Sun Sep 21 02:45:59 2008
> New Revision: 697462
> 
> URL: http://svn.apache.org/viewvc?rev=697462&view=rev
> Log:
> Let's use "mstarted" introduced in r697451 in all places,
> where it makes sense, and "now" mostly where it is now.
> 
> Modified:
>     tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
> 
> Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
> URL: 
> http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp
> _common.c?rev=697462&r1=697461&r2=697462&view=diff
> ============================================================================
> ==
> --- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
> +++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Sun Sep 21
> 02:45:59 2008
> @@ -2803,10 +2803,10 @@
>      return JK_FALSE;
>  }
>  
> -int JK_METHOD ajp_maintain(jk_worker_t *pThis, time_t now, jk_logger_t *l)
> +int JK_METHOD ajp_maintain(jk_worker_t *pThis, time_t mstarted, jk_logger_t
> *l)
>  {
>      JK_TRACE_ENTER(l);
> -    time_t mstarted = now;
> +    time_t now = mstarted;
>  
>      if (pThis && pThis->worker_private) {
>          ajp_worker_t *aw = pThis->worker_private;
> @@ -2821,9 +2821,9 @@
>           * Since it's possible that we come here a few milliseconds
>           * before the interval has passed, we allow a little tolerance.
>           */
> -        delta = (long)difftime(now, aw->s->last_maintain_time) +
> JK_AJP_MAINTAIN_TOLERANCE;
> +        delta = (long)difftime(mstarted, aw->s->last_maintain_time) +
> JK_AJP_MAINTAIN_TOLERANCE;
>          if (delta >= aw->maintain_time) {
> -            aw->s->last_maintain_time = now;
> +            aw->s->last_maintain_time = mstarted;
>              if (aw->s->state == JK_AJP_STATE_OK &&
>                  aw->s->used == aw->s->used_snapshot)
>                  aw->s->state = JK_AJP_STATE_IDLE;
> @@ -2832,7 +2832,7 @@
>  
>          jk_shm_unlock();
>  
> -        /* Obtain current time only if needed */
> +        /* Do connection pool maintenance only if timeouts or keepalives
> are set */
>          if (aw->cache_timeout <= 0 &&
>              aw->connection_keepalive <= 0) {
>              /* Nothing to do. */
> @@ -2854,7 +2854,7 @@
>                   i >= 0 && aw->cache_timeout > 0; i--) {
>                  /* Skip the closed sockets */
>                  if (aw->ep_cache[i] &&
> IS_VALID_SOCKET(aw->ep_cache[i]->sd)) {
> -                    int elapsed = (int)difftime(now,
> aw->ep_cache[i]->last_access);
> +                    int elapsed = (int)difftime(mstarted,
> aw->ep_cache[i]->last_access);
>                      if (elapsed > aw->cache_timeout) {
>                          time_t rt = 0;
>                          n++;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r697462 - /tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c

Posted by Tim Whittington <ti...@orionhealth.com>.
This fails to build in VC.Net 2005 (actually the change in r697451 is the
culprit).
The definition of now/mstarted needs to precede the JK_TRACE_ENTER.

cheers
tim



From: <rj...@apache.org>
Reply-To: Tomcat Developers List <de...@tomcat.apache.org>
Date: Sun, 21 Sep 2008 09:46:00 -0000
To: <de...@tomcat.apache.org>
Subject: svn commit: r697462 -
/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c

Author: rjung
Date: Sun Sep 21 02:45:59 2008
New Revision: 697462

URL: http://svn.apache.org/viewvc?rev=697462&view=rev
Log:
Let's use "mstarted" introduced in r697451 in all places,
where it makes sense, and "now" mostly where it is now.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c

Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp
_common.c?rev=697462&r1=697461&r2=697462&view=diff
============================================================================
==
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Sun Sep 21
02:45:59 2008
@@ -2803,10 +2803,10 @@
     return JK_FALSE;
 }
 
-int JK_METHOD ajp_maintain(jk_worker_t *pThis, time_t now, jk_logger_t *l)
+int JK_METHOD ajp_maintain(jk_worker_t *pThis, time_t mstarted, jk_logger_t
*l)
 {
     JK_TRACE_ENTER(l);
-    time_t mstarted = now;
+    time_t now = mstarted;
 
     if (pThis && pThis->worker_private) {
         ajp_worker_t *aw = pThis->worker_private;
@@ -2821,9 +2821,9 @@
          * Since it's possible that we come here a few milliseconds
          * before the interval has passed, we allow a little tolerance.
          */
-        delta = (long)difftime(now, aw->s->last_maintain_time) +
JK_AJP_MAINTAIN_TOLERANCE;
+        delta = (long)difftime(mstarted, aw->s->last_maintain_time) +
JK_AJP_MAINTAIN_TOLERANCE;
         if (delta >= aw->maintain_time) {
-            aw->s->last_maintain_time = now;
+            aw->s->last_maintain_time = mstarted;
             if (aw->s->state == JK_AJP_STATE_OK &&
                 aw->s->used == aw->s->used_snapshot)
                 aw->s->state = JK_AJP_STATE_IDLE;
@@ -2832,7 +2832,7 @@
 
         jk_shm_unlock();
 
-        /* Obtain current time only if needed */
+        /* Do connection pool maintenance only if timeouts or keepalives
are set */
         if (aw->cache_timeout <= 0 &&
             aw->connection_keepalive <= 0) {
             /* Nothing to do. */
@@ -2854,7 +2854,7 @@
                  i >= 0 && aw->cache_timeout > 0; i--) {
                 /* Skip the closed sockets */
                 if (aw->ep_cache[i] &&
IS_VALID_SOCKET(aw->ep_cache[i]->sd)) {
-                    int elapsed = (int)difftime(now,
aw->ep_cache[i]->last_access);
+                    int elapsed = (int)difftime(mstarted,
aw->ep_cache[i]->last_access);
                     if (elapsed > aw->cache_timeout) {
                         time_t rt = 0;
                         n++;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org