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 2020/10/01 09:23:38 UTC

[tomcat] 01/02: Refactor: remove unused parameter, separate frame create and frame write

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 4885c00f2c27be5fdb53bdd55a7ba3c42e9edb6d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Oct 1 10:18:01 2020 +0100

    Refactor: remove unused parameter, separate frame create and frame write
---
 test/org/apache/coyote/http2/Http2TestBase.java        | 18 ++++++++----------
 test/org/apache/coyote/http2/TestHttp2Section_6_8.java |  2 +-
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/test/org/apache/coyote/http2/Http2TestBase.java b/test/org/apache/coyote/http2/Http2TestBase.java
index ca72aed..1d1fee5 100644
--- a/test/org/apache/coyote/http2/Http2TestBase.java
+++ b/test/org/apache/coyote/http2/Http2TestBase.java
@@ -810,14 +810,9 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    void sendGoaway(int streamId, int lastStreamId, long errorCode, byte[] debug)
-            throws IOException {
+    byte[] buildGoaway(int streamId, int lastStreamId, long errorCode) {
         byte[] goawayFrame = new byte[17];
-        int len = 8;
-        if (debug != null) {
-            len += debug.length;
-        }
-        ByteUtil.setThreeBytes(goawayFrame, 0, len);
+        ByteUtil.setThreeBytes(goawayFrame, 0, 8);
         // Type
         goawayFrame[3] = FrameType.GOAWAY.getIdByte();
         // No flags
@@ -826,10 +821,13 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         // Last stream
         ByteUtil.set31Bits(goawayFrame, 9, lastStreamId);
         ByteUtil.setFourBytes(goawayFrame, 13, errorCode);
+        return goawayFrame;
+    }
+
+
+    void sendGoaway(int streamId, int lastStreamId, long errorCode) throws IOException {
+        byte[] goawayFrame = buildGoaway(streamId, lastStreamId, errorCode);
         os.write(goawayFrame);
-        if (debug != null && debug.length > 0) {
-            os.write(debug);
-        }
         os.flush();
     }
 
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_8.java b/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
index c43a0b5..b80b1a9 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
@@ -76,7 +76,7 @@ public class TestHttp2Section_6_8 extends Http2TestBase {
         // HTTP2 upgrade
         http2Connect();
 
-        sendGoaway(1, 1, Http2Error.NO_ERROR.getCode(), null);
+        sendGoaway(1, 1, Http2Error.NO_ERROR.getCode());
 
         handleGoAwayResponse(1);
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org