You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/09/30 21:27:03 UTC

svn commit: r1527733 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Author: markt
Date: Mon Sep 30 19:27:02 2013
New Revision: 1527733

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

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=1527733&r1=1527732&r2=1527733&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Mon Sep 30 19:27:02 2013
@@ -915,7 +915,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));
@@ -998,12 +999,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);
@@ -1408,7 +1411,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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org