Author: markt
Date: Tue Mar 19 21:12:15 2013
New Revision: 1458523
URL: http://svn.apache.org/r1458523
Log:
Once a close frame has been received, don't process any more frames.
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties?rev=1458523&r1=1458522&r2=1458523&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Tue
Mar 19 21:12:15 2013
@@ -21,6 +21,7 @@ backgroundProcessManager.processFailed=A
# as many as 4 bytes.
wsFrame.bufferTooSmall=No async message support and buffer too small. Buffer
size: [{0}], Message size: [{1}]
wsFrame.byteToLongFail=Too many bytes ([{0}]) were provided to be converted
into a long
+wsFrame.closed=New frame received after a close control frame
wsFrame.controlFragmented=A fragmented control frame was received but control
frames may not be fragmented
wsFrame.controlPayloadTooBig=A control frame was sent with a payload of size
[{0}] which is larger than the maximum permitted of 125 bytes
wsFrame.controlNoFin=A control frame was sent that did not have the fin bit
set. Control frames are not permitted to use continuation frames.
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java?rev=1458523&r1=1458522&r2=1458523&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java Tue Mar 19
21:12:15 2013
@@ -74,6 +74,7 @@ public abstract class WsFrameBase {
// Attributes tracking state
private State state = State.NEW_FRAME;
+ private boolean closed = false;
private int readPos = 0;
protected int writePos = 0;
@@ -93,6 +94,9 @@ public abstract class WsFrameBase {
wsSession.updateLastActive();
if (state == State.NEW_FRAME) {
+ if (closed) {
+ throw new IOException(sm.getString("wsFrame.closed"));
+ }
if (!processInitialHeader()) {
break;
}
@@ -261,6 +265,7 @@ public abstract class WsFrameBase {
}
controlBufferBinary.flip();
if (opCode == Constants.OPCODE_CLOSE) {
+ closed = true;
String reason = null;
int code = CloseCodes.NORMAL_CLOSURE.getCode();
if (controlBufferBinary.remaining() == 1) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]