Author: markt
Date: Wed Nov 20 14:02:28 2013
New Revision: 1543817
URL: http://svn.apache.org/r1543817
Log:
Remove dataMessageInProgress since it is no longer required along with the
supporting code.
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.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=1543817&r1=1543816&r2=1543817&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Wed
Nov 20 14:02:28 2013
@@ -57,7 +57,7 @@ wsRemoteEndpoint.closedWriter=This metho
wsRemoteEndpoint.changeType=When sending a fragmented message, all fragments
bust be of the same type
wsRemoteEndpoint.concurrentMessageSend=Messages may not be sent concurrently
even when using the asynchronous send messages. The client must wait for the
previous message to complete before sending the next.
wsRemoteEndpoint.flushOnCloseFailed=Flushing batched messages before closing
the session failed
-wsRemoteEndpoint.inProgress=Message will not be sent because the WebSocket
session is currently sending another message
+wsRemoteEndpoint.inProgress=Unexpected state. Please report a bug. Message
will not be sent because the WebSocket session is currently sending another
message
wsRemoteEndpoint.invalidEncoder=The specified encoder of type [{0}] could not
be instantiated
wsRemoteEndpoint.noEncoder=No encoder specified for object of class [{0}]
wsRemoteEndpoint.wrongState=Remote endpoint was in state [{0}] but state [{1}]
is required for this action
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java?rev=1543817&r1=1543816&r2=1543817&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
Wed Nov 20 14:02:28 2013
@@ -64,7 +64,6 @@ public abstract class WsRemoteEndpointIm
private boolean messagePartInProgress = false;
private final Queue<MessagePart> messagePartQueue = new ArrayDeque<>();
private final Object messagePartLock = new Object();
- private boolean dataMessageInProgress = false;
// State
private boolean closed = false;
@@ -265,14 +264,15 @@ public abstract class WsRemoteEndpointIm
}
}
if (messagePartInProgress) {
+ // This must be a Control message else the state machine would
+ // have thrown an IllegalStateException.
+ // Leave the check in place for now.
+ // TODO Remove this check if there are no reports of problems
if (!Util.isControl(opCode)) {
- if (dataMessageInProgress) {
- throw new IllegalStateException(
- sm.getString("wsRemoteEndpoint.inProgress"));
- } else {
- dataMessageInProgress = true;
- }
+ throw new IllegalStateException(
+ sm.getString("wsRemoteEndpoint.inProgress"));
}
+ // Add it to the queue
messagePartQueue.add(mp);
} else {
messagePartInProgress = true;
@@ -282,16 +282,12 @@ public abstract class WsRemoteEndpointIm
}
- void endMessage(SendHandler handler, SendResult result,
- boolean dataMessage) {
+ void endMessage(SendHandler handler, SendResult result) {
synchronized (messagePartLock) {
fragmented = nextFragmented;
text = nextText;
- if (dataMessage) {
- dataMessageInProgress = false;
- }
MessagePart mpNext = messagePartQueue.poll();
if (mpNext == null) {
messagePartInProgress = false;
@@ -411,8 +407,7 @@ public abstract class WsRemoteEndpointIm
this.opCode = opCode;
this.payload = payload;
this.last = last;
- this.handler = new EndMessageHandler(
- endpoint, handler, !Util.isControl(opCode));
+ this.handler = new EndMessageHandler(endpoint, handler);
}
@@ -445,19 +440,17 @@ public abstract class WsRemoteEndpointIm
private final WsRemoteEndpointImplBase endpoint;
private final SendHandler handler;
- private final boolean dataMessage;
public EndMessageHandler(WsRemoteEndpointImplBase endpoint,
- SendHandler handler, boolean dataMessage) {
+ SendHandler handler) {
this.endpoint = endpoint;
this.handler = handler;
- this.dataMessage = dataMessage;
}
@Override
public void onResult(SendResult result) {
- endpoint.endMessage(handler, result, dataMessage);
+ endpoint.endMessage(handler, result);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]