Author: markt Date: Thu Jun 4 20:24:32 2015 New Revision: 1683626 URL: http://svn.apache.org/r1683626 Log: Add rst stream processing Clean up some stream related debug log messages
Modified: tomcat/trunk/java/org/apache/coyote/http2/AbstractStream.java tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties tomcat/trunk/java/org/apache/coyote/http2/Stream.java tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java Modified: tomcat/trunk/java/org/apache/coyote/http2/AbstractStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/AbstractStream.java?rev=1683626&r1=1683625&r2=1683626&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/AbstractStream.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/AbstractStream.java Thu Jun 4 20:24:32 2015 @@ -20,8 +20,6 @@ import java.util.HashSet; import java.util.Set; import java.util.concurrent.atomic.AtomicLong; -import org.apache.juli.logging.Log; - /** * Used to managed prioritisation. */ @@ -109,8 +107,6 @@ s * @param increment } - protected abstract Log getLog(); - protected abstract String getConnectionId(); protected abstract int getWeight(); Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java?rev=1683626&r1=1683625&r2=1683626&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java Thu Jun 4 20:24:32 2015 @@ -221,8 +221,11 @@ class Http2Parser { private void readRstFrame(int streamId, int payloadSize) throws IOException { - // TODO: Process this - swallow(payloadSize); + byte[] payload = new byte[4]; + input.fill(true, payload); + + long errorCode = ByteUtil.getFourBytes(payload, 0); + output.reset(streamId, errorCode); } @@ -517,6 +520,9 @@ class Http2Parser { void reprioritise(int streamId, int parentStreamId, boolean exclusive, int weight); void headersEnd(int streamId); + // Reset frames + void reset(int streamId, long errorCode); + // Settings frames void setting(int identifier, long value) throws IOException; void settingsEnd(boolean ack) throws IOException; Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java?rev=1683626&r1=1683625&r2=1683626&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java Thu Jun 4 20:24:32 2015 @@ -616,12 +616,6 @@ public class Http2UpgradeHandler extends @Override - protected final Log getLog() { - return log; - } - - - @Override protected final int getWeight() { return 0; } @@ -749,6 +743,16 @@ public class Http2UpgradeHandler extends } + + @Override + public void reset(int streamId, long errorCode) { + Stream stream = getStream(streamId); + if (stream != null) { + stream.reset(errorCode); + } + } + + @Override public void setting(int identifier, long value) throws IOException { remoteSettings.set(identifier, value); Modified: tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties?rev=1683626&r1=1683625&r2=1683626&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties Thu Jun 4 20:24:32 2015 @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -abstractStream.reprioritisation.debug=Connection [{0}], Stream [{1}], Exclusive [{2}], Parent [{3}], Weight [{4}] - connectionPrefaceParser.eos=Unexpected end of stream while reading opening client preface byte sequence. Only [{0}] bytes read. connectionPrefaceParser.ioError=Failed to read opening client preface byte sequence connectionPrefaceParser.mismatch=An unexpected byte sequence was received at the start of the client preface [{0}] @@ -56,6 +54,8 @@ http2Parser.processFrameWindowUpdate.inv http2Parser.processFrameWindowUpdate.invalidPayloadSize=Window update frame received with an invalid payload size of [{0}] stream.header.debug=Connection [{0}], Stream [{1}], HTTP header [{2}], Value [{3}] +stream.reprioritisation.debug=Connection [{0}], Stream [{1}], Exclusive [{2}], Parent [{3}], Weight [{4}] +stream.reset.debug=Connection [{0}], Stream [{1}], Reset due to [{2}] stream.write=Connection [{0}], Stream [{1}] streamProcessor.httpupgrade.notsupported=HTTP upgrade is not supported within HTTP/2 streams Modified: tomcat/trunk/java/org/apache/coyote/http2/Stream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Stream.java?rev=1683626&r1=1683625&r2=1683626&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/Stream.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/Stream.java Thu Jun 4 20:24:32 2015 @@ -69,8 +69,8 @@ public class Stream extends AbstractStre public void rePrioritise(AbstractStream parent, boolean exclusive, int weight) { - if (getLog().isDebugEnabled()) { - getLog().debug(sm.getString("abstractStream.reprioritisation.debug", + if (log.isDebugEnabled()) { + log.debug(sm.getString("stream.reprioritisation.debug", getConnectionId(), getIdentifier(), Boolean.toString(exclusive), parent.getIdentifier(), Integer.toString(weight))); } @@ -96,6 +96,15 @@ public class Stream extends AbstractStre } + public void reset(long errorCode) { + if (log.isDebugEnabled()) { + log.debug(sm.getString("stream.reset.debug", getConnectionId(), getIdentifier(), + Long.toString(errorCode))); + } + state.recieveReset(); + } + + @Override public void incrementWindowSize(int windowSizeIncrement) throws Http2Exception { // If this is zero then any thread that has been trying to write for @@ -190,12 +199,6 @@ public class Stream extends AbstractStre } - @Override - protected final Log getLog() { - return log; - } - - @Override protected final String getConnectionId() { return getParentStream().getConnectionId(); Modified: tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java?rev=1683626&r1=1683625&r2=1683626&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java (original) +++ tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java Thu Jun 4 20:24:32 2015 @@ -476,6 +476,12 @@ public abstract class Http2TestBase exte @Override + public void reset(int streamId, long errorCode) { + trace.append(streamId + "-RST-[" + errorCode + "]"); + } + + + @Override public void setting(int identifier, long value) throws IOException { trace.append("0-Settings-[" + identifier + "]-[" + value + "]\n"); remoteSettings.set(identifier, value); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org