tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1719459 - in /tomcat/trunk/java/org/apache/tomcat/websocket: WsSession.java server/LocalStrings.properties server/WsHttpUpgradeHandler.java
Date Fri, 11 Dec 2015 15:31:15 GMT
Author: markt
Date: Fri Dec 11 15:31:15 2015
New Revision: 1719459

URL: http://svn.apache.org/viewvc?rev=1719459&view=rev
Log:
Close the session before closing the connection if a low-level I/O error is experienced.

Modified:
    tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java
    tomcat/trunk/java/org/apache/tomcat/websocket/server/LocalStrings.properties
    tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java?rev=1719459&r1=1719458&r2=1719459&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsSession.java Fri Dec 11 15:31:15 2015
@@ -464,7 +464,7 @@ public class WsSession implements Sessio
      * Need internal close method as spec requires that the local endpoint
      * receives a 1006 on timeout.
      */
-    protected void doClose(CloseReason closeReasonMessage, CloseReason closeReasonLocal)
{
+    public void doClose(CloseReason closeReasonMessage, CloseReason closeReasonLocal) {
         // Double-checked locking. OK because state is volatile
         if (state != State.OPEN) {
             return;

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/server/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/server/LocalStrings.properties?rev=1719459&r1=1719458&r2=1719459&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/server/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/server/LocalStrings.properties Fri Dec 11
15:31:15 2015
@@ -34,6 +34,7 @@ uriTemplate.invalidSegment=The segment [
 wsFrameServer.bytesRead=Read [{0}] bytes into input buffer ready for processing
 wsFrameServer.onDataAvailable=Method entry
 
+wsHttpUpgradeHandler.closeOnError=Closing WebSocket connection due to an error
 wsHttpUpgradeHandler.destroyFailed=Failed to close WebConnection while destroying the WebSocket
HttpUpgradeHandler
 wsHttpUpgradeHandler.noPreInit=The preInit() method must be called to configure the WebSocket
HttpUpgradeHandler before the container calls init(). Usually, this means the Servlet that
created the WsHttpUpgradeHandler instance should also call preInit()
 wsHttpUpgradeHandler.serverStop=The server is stopping

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=1719459&r1=1719458&r2=1719459&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java Fri Dec
11 15:31:15 2015
@@ -174,11 +174,15 @@ public class WsHttpUpgradeHandler implem
                     close(cr);
                 }
                 break;
+            case ERROR:
+                String msg = sm.getString("wsHttpUpgradeHandler.closeOnError");
+                wsSession.doClose(new CloseReason(CloseCodes.GOING_AWAY, msg),
+                        new CloseReason(CloseCodes.CLOSED_ABNORMALLY, msg));
+                //$FALL-THROUGH$
             case ASYNC_READ_ERROR:
             case ASYNC_WRITE_ERROR:
             case CLOSE_NOW:
             case DISCONNECT:
-            case ERROR:
             case TIMEOUT:
                 return SocketState.CLOSED;
 



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


Mime
View raw message