On 21.12.2009 13:02, mt...@apache.org wrote:
Author: mturk
Date: Mon Dec 21 12:02:54 2009
New Revision: 892787

URL: http://svn.apache.org/viewvc?rev=892787&view=rev
Log:
Fix #47224 by invalidating endoint cache on address change

Modified:
     tomcat/jk/trunk/native/common/jk_ajp_common.c
     tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml

Modified: tomcat/jk/trunk/native/common/jk_ajp_common.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_ajp_common.c?rev=892787&r1=892786&r2=892787&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_ajp_common.c (original)
+++ tomcat/jk/trunk/native/common/jk_ajp_common.c Mon Dec 21 12:02:54 2009
@@ -1066,9 +1066,18 @@
      aw->s->max_packet_size = aw->max_packet_size;
      aw->s->h.sequence = aw->sequence;
      if (aw->s->addr_sequence != aw->addr_sequence) {
+        unsigned int i;
          aw->s->addr_sequence = aw->addr_sequence;
          strncpy(aw->s->host, aw->host, JK_SHM_STR_SIZ);
          aw->s->port = aw->port;
+        for (i = 0; i<  aw->ep_cache_sz; i++) {
+            /* Close all connections in the cache */
+            if (aw->ep_cache[i]&&  IS_VALID_SOCKET(aw->ep_cache[i]->sd)) {
+                int sd = aw->ep_cache[i]->sd;
+                aw->ep_cache[i]->sd = JK_INVALID_SOCKET;
+                jk_shutdown_socket(sd, l);
+            }
+        }
      }

Don't we need a kind of generation counter? All connections which are established and actually in use for requests at the moment this code runs will not be closed and returned to the cache and reused when the requests end.

I guess we need a generation counter in the cache that gets incremented when we want to recycle the whole cache, and each new connection gets the recent generation counter and when returned to the pool is gets closed if the generation counter is to old.

Right?

This would also help in allowing to dynamicaly change more communication parameters that are associeted to connections because we then have a general signalling mechanism to invalidate connections which were established with previous parameters.

Regards,

Rainer

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

Reply via email to