Author: remy.maucherat(a)jboss.com
Date: 2014-05-26 18:11:33 -0400 (Mon, 26 May 2014)
New Revision: 2421
Modified:
branches/7.4.x/src/main/java/org/apache/tomcat/websocket/Constants.java
branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsSession.java
Log:
- Rather than just reverting again, add a system property. The default is what it was
before reverting it.
- Either way passes the TCK for me.
Modified: branches/7.4.x/src/main/java/org/apache/tomcat/websocket/Constants.java
===================================================================
--- branches/7.4.x/src/main/java/org/apache/tomcat/websocket/Constants.java 2014-05-26
21:23:20 UTC (rev 2420)
+++ branches/7.4.x/src/main/java/org/apache/tomcat/websocket/Constants.java 2014-05-26
22:11:33 UTC (rev 2421)
@@ -60,6 +60,9 @@
public static final boolean STRICT_SPEC_COMPLIANCE =
Boolean.getBoolean(
"org.apache.tomcat.websocket.STRICT_SPEC_COMPLIANCE");
+ public static final boolean STRICT_SPEC_CLOSE_EVENT =
+ Boolean.getBoolean(
+ "org.apache.tomcat.websocket.STRICT_SPEC_CLOSE_EVENT");
private Constants() {
// Hide default constructor
Modified: branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsSession.java
===================================================================
--- branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsSession.java 2014-05-26
21:23:20 UTC (rev 2420)
+++ branches/7.4.x/src/main/java/org/apache/tomcat/websocket/WsSession.java 2014-05-26
22:11:33 UTC (rev 2421)
@@ -406,8 +406,13 @@
state = State.CLOSING;
- sendCloseMessage(closeReasonMessage);
- fireEndpointOnClose(closeReasonLocal);
+ if (Constants.STRICT_SPEC_CLOSE_EVENT) {
+ sendCloseMessage(closeReasonMessage);
+ fireEndpointOnClose(closeReasonLocal);
+ } else {
+ fireEndpointOnClose(closeReasonLocal);
+ sendCloseMessage(closeReasonMessage);
+ }
state = State.CLOSED;
}
@@ -429,8 +434,13 @@
synchronized (stateLock) {
if (state == State.OPEN) {
- sendCloseMessage(closeReason);
- fireEndpointOnClose(closeReason);
+ if (Constants.STRICT_SPEC_CLOSE_EVENT) {
+ sendCloseMessage(closeReason);
+ fireEndpointOnClose(closeReason);
+ } else {
+ fireEndpointOnClose(closeReason);
+ sendCloseMessage(closeReason);
+ }
state = State.CLOSED;
}
Show replies by date