Author: markt
Date: Thu Mar 29 20:03:20 2012
New Revision: 1307084
URL: http://svn.apache.org/viewvc?rev=1307084&view=rev
Log:
Fix a hanging test with APR. Connections using HTTP keep-alive were not closed
on Endpoint.stop() so a stop() start() sequence meant they were kept open with
any data sent being ignored until the connection timed out.
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1307084&r1=1307083&r2=1307084&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Thu Mar 29
20:03:20 2012
@@ -929,12 +929,19 @@ public class AprEndpoint extends Abstrac
return true;
}
- private void destroySocket(long socket)
- {
- if (running && socket != 0) {
- // If not running the socket will be destroyed by
- // parent pool or acceptor socket.
- // In any case disable double free which would cause JVM core.
+ private void destroySocket(long socket) {
+ // If not running the socket will be destroyed by
+ // parent pool or acceptor socket.
+ // In any case disable double free which would cause JVM core.
+ destroySocket(socket, running);
+ }
+
+ private void destroySocket(long socket, boolean doIt) {
+ // Be VERY careful if you call this method directly. If it is called
+ // twice for the same socket the JVM will core. Currently this is only
+ // called from Poller.closePollset() to ensure kept alive connections
+ // are closed when calling stop() followed by start().
+ if (doIt && socket != 0) {
Socket.destroy(socket);
countDownConnection();
}
@@ -1183,7 +1190,7 @@ public class AprEndpoint extends Abstrac
if (comet) {
processSocket(desc[n*2+1], SocketStatus.STOP);
} else {
- destroySocket(desc[n*2+1]);
+ destroySocket(desc[n*2+1], true);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]