Author: markt
Date: Sun Mar 24 21:00:59 2013
New Revision: 1460462
URL: http://svn.apache.org/r1460462
Log:
Once we have all of a partial message send it on if we can. Don't buffer it as
we have no idea if/when the next part of the message might arrive.
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java
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=1460462&r1=1460461&r2=1460462&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java Sun Mar 24
21:00:59 2013
@@ -450,18 +450,24 @@ public abstract class WsFrameBase {
}
// Frame is fully received
- if (continuationExpected) {
- // More data for this message expected
- newFrame();
- } else {
- // Message is complete - send it
+ // Send the message if either:
+ // - partial messages are supported
+ // - the message is complete
+ if (usePartial() || !continuationExpected) {
messageBufferBinary.flip();
ByteBuffer copy =
ByteBuffer.allocate(messageBufferBinary.limit());
copy.put(messageBufferBinary);
copy.flip();
- sendMessageBinary(copy, true);
+ sendMessageBinary(copy, !continuationExpected);
messageBufferBinary.clear();
+ }
+
+ if (continuationExpected) {
+ // More data for this message expected, start a new frame
+ newFrame();
+ } else {
+ // Message is complete, start a new message
newMessage();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]