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 12:18:21 UTC
svn commit: r697467 -
/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
Author: rjung
Date: Sun Sep 21 03:18:20 2008
New Revision: 697467
URL: http://svn.apache.org/viewvc?rev=697467&view=rev
Log:
Move logical condition from "from" to enclosing "if".
Use "svn diff -x -w" to get a more condensed view
of the change.
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=697467&r1=697466&r2=697467&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 03:18:20 2008
@@ -2849,60 +2849,62 @@
if (aw->ep_cache[i] && IS_VALID_SOCKET(aw->ep_cache[i]->sd))
cnt++;
}
- /* Handle worker cache and recycle timeouts */
- for (i = (int)aw->ep_cache_sz - 1;
- 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(mstarted, aw->ep_cache[i]->last_access);
- if (elapsed > aw->cache_timeout) {
- time_t rt = 0;
- n++;
- if (JK_IS_DEBUG_LEVEL(l))
- rt = time(NULL);
- aw->ep_cache[i]->reuse = JK_FALSE;
- ajp_reset_endpoint(aw->ep_cache[i], l);
- if (JK_IS_DEBUG_LEVEL(l))
- jk_log(l, JK_LOG_DEBUG,
- "cleaning pool slot=%d elapsed %d in %d",
- i, elapsed, (int)(difftime(time(NULL), rt)));
+ /* Handle worker cache timeouts */
+ if (aw->cache_timeout > 0) {
+ for (i = (int)aw->ep_cache_sz - 1;
+ i >= 0; i--) {
+ /* Skip the closed sockets */
+ if (aw->ep_cache[i] && IS_VALID_SOCKET(aw->ep_cache[i]->sd)) {
+ int elapsed = (int)difftime(mstarted, aw->ep_cache[i]->last_access);
+ if (elapsed > aw->cache_timeout) {
+ time_t rt = 0;
+ n++;
+ if (JK_IS_DEBUG_LEVEL(l))
+ rt = time(NULL);
+ aw->ep_cache[i]->reuse = JK_FALSE;
+ ajp_reset_endpoint(aw->ep_cache[i], l);
+ if (JK_IS_DEBUG_LEVEL(l))
+ jk_log(l, JK_LOG_DEBUG,
+ "cleaning pool slot=%d elapsed %d in %d",
+ i, elapsed, (int)(difftime(time(NULL), rt)));
+ }
}
- }
- if (cnt <= aw->ep_mincache_sz + n) {
- if (JK_IS_DEBUG_LEVEL(l)) {
- jk_log(l, JK_LOG_DEBUG,
- "reached pool min size %u from %u cache slots",
- aw->ep_mincache_sz, aw->ep_cache_sz);
+ if (cnt <= aw->ep_mincache_sz + n) {
+ if (JK_IS_DEBUG_LEVEL(l)) {
+ jk_log(l, JK_LOG_DEBUG,
+ "reached pool min size %u from %u cache slots",
+ aw->ep_mincache_sz, aw->ep_cache_sz);
+ }
+ break;
}
- break;
}
}
/* Handle worker connection keepalive */
- for (i = (int)aw->ep_cache_sz - 1; i >= 0 &&
- aw->connection_keepalive > 0 &&
- aw->prepost_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);
- if (elapsed > aw->connection_keepalive) {
- k++;
- /* handle cping/cpong.
- */
- if (ajp_handle_cping_cpong(aw->ep_cache[i],
- aw->prepost_timeout, l) == JK_FALSE) {
- jk_log(l, JK_LOG_INFO,
- "(%s) failed sending request, "
- "socket %d keepalive cping/cpong "
- "failure (errno=%d)",
- aw->name,
- aw->ep_cache[i]->sd,
- aw->ep_cache[i]->last_errno);
- aw->ep_cache[i]->reuse = JK_FALSE;
- ajp_reset_endpoint(aw->ep_cache[i], l);
- }
- else {
- now = time(NULL);
- aw->ep_cache[i]->last_access = now;
+ if (aw->connection_keepalive > 0 && aw->prepost_timeout > 0) {
+ for (i = (int)aw->ep_cache_sz - 1; i >= 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);
+ if (elapsed > aw->connection_keepalive) {
+ k++;
+ /* handle cping/cpong.
+ */
+ if (ajp_handle_cping_cpong(aw->ep_cache[i],
+ aw->prepost_timeout, l) == JK_FALSE) {
+ jk_log(l, JK_LOG_INFO,
+ "(%s) failed sending request, "
+ "socket %d keepalive cping/cpong "
+ "failure (errno=%d)",
+ aw->name,
+ aw->ep_cache[i]->sd,
+ aw->ep_cache[i]->last_errno);
+ aw->ep_cache[i]->reuse = JK_FALSE;
+ ajp_reset_endpoint(aw->ep_cache[i], l);
+ }
+ else {
+ now = time(NULL);
+ aw->ep_cache[i]->last_access = now;
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org