Author: markt
Date: Mon Sep 30 19:38:05 2013
New Revision: 1527742

URL: http://svn.apache.org/r1527742
Log:
Switch to destroySocket in a few places where it is safe to do so.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1527733

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1527742&r1=1527741&r2=1527742&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Mon 
Sep 30 19:38:05 2013
@@ -907,7 +907,8 @@ public class AprEndpoint extends Abstrac
 
     /*
      * This method should only be called if there is no chance that the socket
-     * is currently being used by the Poller.
+     * is currently being used by the Poller. It is generally a bad idea to 
call
+     * this directly from a known error condition.
      */
     private void destroySocket(long socket) {
         connections.remove(Long.valueOf(socket));
@@ -990,12 +991,14 @@ public class AprEndpoint extends Abstrac
                     if (running && !paused) {
                         // Hand this socket off to an appropriate processor
                         if (!processSocketWithOptions(socket)) {
-                            // Close socket and pool right away
+                            // Close socket right away
                             closeSocket(socket);
                         }
                     } else {
-                        // Close socket and pool right away
-                        closeSocket(socket);
+                        // Close socket right away
+                        // No code path could have added the socket to the
+                        // Poller so use destroySocket()
+                        destroySocket(socket);
                     }
                 } catch (Throwable t) {
                     ExceptionUtils.handleThrowable(t);
@@ -1400,7 +1403,9 @@ public class AprEndpoint extends Abstrac
                         connections.get(Long.valueOf(info.socket)).isComet();
                 if (!comet || (comet && !processSocket(
                         info.socket, SocketStatus.STOP))) {
-                    closeSocket(info.socket);
+                    // Poller isn't running at this point so use 
destroySocket()
+                    // directly
+                    destroySocket(info.socket);
                 }
                 info = addList.get();
             }



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

Reply via email to