Author: markt Date: Thu Mar 22 19:48:52 2012 New Revision: 1304012 URL: http://svn.apache.org/viewvc?rev=1304012&view=rev Log: Still process events when closing to ensure that Comet connections that are in use when the poller is stopped are sent an end event.
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1304011 Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1304012&r1=1304011&r2=1304012&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Thu Mar 22 19:48:52 2012 @@ -963,7 +963,6 @@ public class NioEndpoint extends Abstrac // exit, otherwise parallel closure of sockets which are still // in the poller can cause problems close = true; - events.clear(); selector.wakeup(); } @@ -998,6 +997,9 @@ public class NioEndpoint extends Abstrac if ( r==null) r = new PollerEvent(socket,null,interestOps); else r.reset(socket,null,interestOps); addEvent(r); + if (close) { + processSocket(socket, SocketStatus.STOP, false); + } } /** @@ -1114,12 +1116,15 @@ public class NioEndpoint extends Abstrac } } - boolean hasEvents = events(); + boolean hasEvents = false; // Time to terminate? if (close) { + events(); timeout(0, false); break; + } else { + hasEvents = events(); } try { if ( !close ) { @@ -1133,6 +1138,7 @@ public class NioEndpoint extends Abstrac wakeupCounter.set(0); } if (close) { + events(); timeout(0, false); selector.close(); break; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org