You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2019/04/30 13:44:21 UTC
[tomcat] branch master updated: Simplify code,
cleanup and improve comments
This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new de57438 Simplify code, cleanup and improve comments
de57438 is described below
commit de57438cdf06aa1dea090a7baaf4373f729d5e97
Author: remm <re...@apache.org>
AuthorDate: Tue Apr 30 15:44:08 2019 +0200
Simplify code, cleanup and improve comments
---
java/org/apache/coyote/http2/Http2AsyncParser.java | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/java/org/apache/coyote/http2/Http2AsyncParser.java b/java/org/apache/coyote/http2/Http2AsyncParser.java
index 3cf6d1b..92bf09f 100644
--- a/java/org/apache/coyote/http2/Http2AsyncParser.java
+++ b/java/org/apache/coyote/http2/Http2AsyncParser.java
@@ -108,25 +108,19 @@ class Http2AsyncParser extends Http2Parser {
if (streamException) {
swallow(streamId, payloadSize, false, payload);
} else {
- switch (frameType) {
- case SETTINGS:
- readSettingsFrame(flags, payloadSize, payload);
- break;
- default:
- // Should never happen as the frame has been validated as SETTINGS
- throw new StreamException(sm.getString("http2Parser.processFrame.unexpectedType",
- FrameType.SETTINGS, frameType), Http2Error.PROTOCOL_ERROR, streamId);
- }
+ readSettingsFrame(flags, payloadSize, payload);
}
} catch (RuntimeException | IOException | Http2Exception e) {
error = e;
}
+ // Any extra frame is not processed yet, so put back any leftover data
if (payload.hasRemaining()) {
socketWrapper.unRead(payload);
}
}
- // Continue processing the intial parts of the connection
+ // Finish processing the connection
upgradeHandler.processConnectionCallback(webConnection, stream);
+ // Continue reading frames
upgradeHandler.upgradeDispatch(SocketEvent.OPEN_READ);
}
@@ -166,17 +160,17 @@ class Http2AsyncParser extends Http2Parser {
private class FrameCompletionHandler implements CompletionCheck, CompletionHandler<Long, Void> {
- protected boolean parsedFrameHeader = false;
- protected boolean validated = false;
-
private final FrameType expected;
protected final ByteBuffer[] buffers;
+
+ private boolean parsedFrameHeader = false;
+ private boolean validated = false;
+ private CompletionState state = null;
protected int payloadSize;
protected FrameType frameType;
protected int flags;
protected int streamId;
protected boolean streamException = false;
- protected CompletionState state = null;
private FrameCompletionHandler(FrameType expected, ByteBuffer... buffers) {
this.expected = expected;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org