Author: markt
Date: Sun Feb  4 18:53:31 2018
New Revision: 1823102

URL: http://svn.apache.org/viewvc?rev=1823102&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=62024
When closing a connection with an abnormal close, close the socket immediately 
rather than waiting for a close message from the client that may never arrive.

Modified:
    
tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: 
tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java?rev=1823102&r1=1823101&r2=1823102&view=diff
==============================================================================
--- 
tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java 
Sun Feb  4 18:53:31 2018
@@ -147,7 +147,14 @@ public class WsHttpUpgradeHandler implem
                 try {
                     return wsFrame.notifyDataAvailable();
                 } catch (WsIOException ws) {
-                    close(ws.getCloseReason());
+                    CloseReason cr = ws.getCloseReason();
+                    close(cr);
+                    // If the close was abnormal, close the socket.
+                    // Don't wait for a close response from the client that
+                    // might never arrive.
+                    if (cr.getCloseCode() == CloseCodes.CLOSED_ABNORMALLY) {
+                        return SocketState.CLOSED;
+                    }
                 } catch (IOException ioe) {
                     onError(ioe);
                     CloseReason cr = new CloseReason(

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1823102&r1=1823101&r2=1823102&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Sun Feb  4 18:53:31 2018
@@ -159,6 +159,15 @@
       </add>
     </changelog>
   </subsection>
+  <subsection name="WebSocket">
+    <changelog>
+      <fix>
+        <bug>62024</bug>: When closing a connection with an abnormal close,
+        close the socket immediately rather than waiting for a close message
+        from the client that may never arrive. (markt)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Webapps">
     <changelog>
       <fix>



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

Reply via email to