tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r428896 - in /tomcat/tc6.0.x/trunk/java/org/apache: coyote/http11/InternalNioInputBuffer.java tomcat/util/net/NioChannel.java tomcat/util/net/NioEndpoint.java tomcat/util/net/SecureNioChannel.java
Date Fri, 04 Aug 2006 21:52:52 GMT
Author: fhanik
Date: Fri Aug  4 14:52:51 2006
New Revision: 428896

URL: http://svn.apache.org/viewvc?rev=428896&view=rev
Log:
Correct close down, now the close can be limited to 2 files if it needs to change

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
    tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java
    tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
    tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java?rev=428896&r1=428895&r2=428896&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java Fri Aug
 4 14:52:51 2006
@@ -588,13 +588,12 @@
                     if (key != null) key.interestOps(SelectionKey.OP_READ);
                 } catch (CancelledKeyException ckx) {
                     try {
-                        if ( key != null && key.attachment() != null ) {
-                            KeyAttachment ka = (KeyAttachment)key.attachment();
-                            ka.setError(true); //set to collect this socket immediately
+                        if ( att != null ) {
+                            att.setError(true); //set to collect this socket immediately
+                            att.setWakeUp(false);
                         }
-                        socket.getIOChannel().socket().close();
-                        socket.close();
-                        att.setWakeUp(false);
+                        try {socket.close();}catch (Exception ignore){}
+                        if ( socket.isOpen() ) socket.close(true);
                     } catch (Exception ignore) {}
                 }
             }

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java?rev=428896&r1=428895&r2=428896&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java Fri Aug  4 14:52:51
2006
@@ -51,11 +51,12 @@
      * @todo Implement this java.nio.channels.Channel method
      */
     public void close() throws IOException {
+        getIOChannel().socket().close();
         sc.close();
     }
 
     public void close(boolean force) throws IOException {
-        close();
+        if (isOpen() || force ) close();
     }
     /**
      * Tells whether or not this channel is open.

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=428896&r1=428895&r2=428896&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Fri Aug  4 14:52:51
2006
@@ -937,8 +937,8 @@
                                 KeyAttachment ka = (KeyAttachment)key.attachment();
                                 ka.setError(true); //set to collect this socket immediately
                             }
-                            socket.getIOChannel().socket().close();
-                            socket.close();
+                            try {socket.close();}catch (Exception ignore){}
+                            if ( socket.isOpen() ) socket.close(true);
                         } catch ( Exception ignore ) {}
                     }
                 }
@@ -1259,16 +1259,16 @@
                     if ((event) && (handler.event(socket, error) == Handler.SocketState.CLOSED))
{
                         // Close socket and pool
                         try {
-                            socket.getIOChannel().socket().close();
-                            socket.close();
+                            try {socket.close();}catch (Exception ignore){}
+                            if ( socket.isOpen() ) socket.close(true);
                         }catch ( Exception x ) {
                             log.error("",x);
                         }
                     } else if ((!event) && (handler.process(socket) == Handler.SocketState.CLOSED))
{
                         // Close socket and pool
                         try {
-                            socket.getIOChannel().socket().close();
-                            socket.close();
+                            try {socket.close();}catch (Exception ignore){}
+                            if ( socket.isOpen() ) socket.close(true);
                         }catch ( Exception x ) {
                             log.error("",x);
                         }
@@ -1431,8 +1431,8 @@
             if (handler.process(socket) == Handler.SocketState.CLOSED) {
                 // Close socket and pool
                 try {
-                    socket.getIOChannel().socket().close();
-                    socket.close();
+                    try {socket.close();}catch (Exception ignore){}
+                    if ( socket.isOpen() ) socket.close(true);
                 } catch ( Exception x ) {
                     log.error("",x);
                 }
@@ -1467,8 +1467,8 @@
             if (handler.event(socket, error) == Handler.SocketState.CLOSED) {
                 // Close socket and pool
                 try {
-                    socket.getIOChannel().socket().close();
-                    socket.close();
+                    try {socket.close();}catch (Exception ignore){}
+                    if ( socket.isOpen() ) socket.close(true);
                 } catch ( Exception x ) {
                     log.error("",x);
                 }

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java?rev=428896&r1=428895&r2=428896&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java Fri Aug  4
14:52:51 2006
@@ -268,8 +268,11 @@
         try {
             close();
         }finally {
-            closed = true;
-            sc.close();
+            if ( force || closed ) {
+                closed = true;
+                sc.socket().close();
+                sc.close();
+            }
         }
     }
 



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


Mime
View raw message