You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/06/10 16:23:49 UTC
svn commit: r1684682 -
/tomcat/trunk/java/org/apache/coyote/http2/StreamStateMachine.java
Author: markt
Date: Wed Jun 10 14:23:48 2015
New Revision: 1684682
URL: http://svn.apache.org/r1684682
Log:
HTTP/2 5.1.2 requires active streams to be counted. Add an active flag (currently unused) to Stream.
Try a different format for State enum constructors. Uses more space but I think it is clearer.
Modified:
tomcat/trunk/java/org/apache/coyote/http2/StreamStateMachine.java
Modified: tomcat/trunk/java/org/apache/coyote/http2/StreamStateMachine.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/StreamStateMachine.java?rev=1684682&r1=1684681&r2=1684682&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/StreamStateMachine.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/StreamStateMachine.java Wed Jun 10 14:23:48 2015
@@ -125,35 +125,58 @@ public class StreamStateMachine {
}
+ public synchronized boolean isActive() {
+ return state.isActive();
+ }
+
+
private enum State {
- IDLE (true, Http2Error.PROTOCOL_ERROR, FrameType.HEADERS, FrameType.PRIORITY),
- OPEN (true, Http2Error.PROTOCOL_ERROR, FrameType.DATA, FrameType.HEADERS,
- FrameType.PRIORITY, FrameType.RST, FrameType.PUSH_PROMISE,
- FrameType.WINDOW_UPDATE),
- RESERVED_LOCAL (true, Http2Error.PROTOCOL_ERROR, FrameType.PRIORITY, FrameType.RST,
- FrameType.WINDOW_UPDATE),
- RESERVED_REMOTE (true, Http2Error.PROTOCOL_ERROR, FrameType.HEADERS, FrameType.PRIORITY,
- FrameType.RST),
- HALF_CLOSED_LOCAL (true, Http2Error.PROTOCOL_ERROR, FrameType.DATA, FrameType.HEADERS,
- FrameType.PRIORITY, FrameType.RST, FrameType.PUSH_PROMISE,
- FrameType.WINDOW_UPDATE),
- HALF_CLOSED_REMOTE (true, Http2Error.STREAM_CLOSED, FrameType.PRIORITY, FrameType.RST,
- FrameType.WINDOW_UPDATE),
- CLOSED_RX (true, Http2Error.STREAM_CLOSED, FrameType.PRIORITY),
- CLOSED_TX (true, Http2Error.STREAM_CLOSED, FrameType.PRIORITY, FrameType.RST,
- FrameType.WINDOW_UPDATE),
- CLOSED_RST_RX (false, Http2Error.STREAM_CLOSED, FrameType.PRIORITY),
- CLOSED_RST_TX (false, Http2Error.STREAM_CLOSED, FrameType.DATA, FrameType.HEADERS,
- FrameType.PRIORITY, FrameType.RST, FrameType.PUSH_PROMISE,
- FrameType.WINDOW_UPDATE),
- CLOSED_FINAL (true, Http2Error.PROTOCOL_ERROR, FrameType.PRIORITY);
+ IDLE (false, true, Http2Error.PROTOCOL_ERROR, FrameType.HEADERS,
+ FrameType.PRIORITY),
+ OPEN (true, true, Http2Error.PROTOCOL_ERROR, FrameType.DATA,
+ FrameType.HEADERS,
+ FrameType.PRIORITY,
+ FrameType.RST,
+ FrameType.PUSH_PROMISE,
+ FrameType.WINDOW_UPDATE),
+ RESERVED_LOCAL (false, true, Http2Error.PROTOCOL_ERROR, FrameType.PRIORITY,
+ FrameType.RST,
+ FrameType.WINDOW_UPDATE),
+ RESERVED_REMOTE (false, true, Http2Error.PROTOCOL_ERROR, FrameType.HEADERS,
+ FrameType.PRIORITY,
+ FrameType.RST),
+ HALF_CLOSED_LOCAL (true, true, Http2Error.PROTOCOL_ERROR, FrameType.DATA,
+ FrameType.HEADERS,
+ FrameType.PRIORITY,
+ FrameType.RST,
+ FrameType.PUSH_PROMISE,
+ FrameType.WINDOW_UPDATE),
+ HALF_CLOSED_REMOTE (true, true, Http2Error.STREAM_CLOSED, FrameType.PRIORITY,
+ FrameType.RST,
+ FrameType.WINDOW_UPDATE),
+ CLOSED_RX (false, true, Http2Error.STREAM_CLOSED, FrameType.PRIORITY),
+ CLOSED_TX (false, true, Http2Error.STREAM_CLOSED, FrameType.PRIORITY,
+ FrameType.RST,
+ FrameType.WINDOW_UPDATE),
+ CLOSED_RST_RX (false, false, Http2Error.STREAM_CLOSED, FrameType.PRIORITY),
+ CLOSED_RST_TX (false, false, Http2Error.STREAM_CLOSED, FrameType.DATA,
+ FrameType.HEADERS,
+ FrameType.PRIORITY,
+ FrameType.RST,
+ FrameType.PUSH_PROMISE,
+ FrameType.WINDOW_UPDATE),
+ // TODO: This state may end up being removed and replaced by the stream
+ // being removed from the map in the upgrade handler.
+ CLOSED_FINAL (false, true, Http2Error.PROTOCOL_ERROR, FrameType.PRIORITY);
+ private final boolean active;
private final boolean connectionErrorForInvalidFrame;
private final Http2Error errorCodeForInvalidFrame;
private final Set<FrameType> frameTypesPermitted = new HashSet<>();
- private State(boolean connectionErrorForInvalidFrame, Http2Error errorCode,
- FrameType... frameTypes) {
+ private State(boolean active, boolean connectionErrorForInvalidFrame,
+ Http2Error errorCode, FrameType... frameTypes) {
+ this.active = active;
this.connectionErrorForInvalidFrame = connectionErrorForInvalidFrame;
this.errorCodeForInvalidFrame = errorCode;
for (FrameType frameType : frameTypes) {
@@ -161,6 +184,10 @@ public class StreamStateMachine {
}
}
+ public boolean isActive() {
+ return active;
+ }
+
public boolean isFrameTypePermitted(FrameType frameType) {
return frameTypesPermitted.contains(frameType);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org