Author: markt
Date: Fri Mar 24 22:47:41 2017
New Revision: 1788554

URL: http://svn.apache.org/viewvc?rev=1788554&view=rev
Log:
Add an undocumented option for use when running test suites that disables 
server initiated ping frames since some test suites don't expect them .

Modified:
    tomcat/trunk/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
    tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java
    tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java?rev=1788554&r1=1788553&r2=1788554&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java Fri 
Mar 24 22:47:41 2017
@@ -308,6 +308,9 @@ public class Http2AsyncUpgradeHandler ex
     protected class AsyncPingManager extends PingManager {
         @Override
         public void sendPing(boolean force) throws IOException {
+            if (initiateDisabled) {
+                return;
+            }
             long now = System.nanoTime();
             if (force || now - lastPingNanoTime > pingIntervalNano) {
                 lastPingNanoTime = now;

Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java?rev=1788554&r1=1788553&r2=1788554&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Http2Protocol.java Fri Mar 24 
22:47:41 2017
@@ -69,7 +69,7 @@ public class Http2Protocol implements Up
     private int maxHeaderSize = Constants.DEFAULT_MAX_HEADER_SIZE;
     private int maxTrailerCount = Constants.DEFAULT_MAX_TRAILER_COUNT;
     private int maxTrailerSize = Constants.DEFAULT_MAX_TRAILER_SIZE;
-
+    private boolean initiatePingDisabled = false;
 
     @Override
     public String getHttpUpgradeName(boolean isSSLEnabled) {
@@ -116,6 +116,7 @@ public class Http2Protocol implements Up
         result.setMaxHeaderSize(getMaxHeaderSize());
         result.setMaxTrailerCount(getMaxTrailerCount());
         result.setMaxTrailerSize(getMaxTrailerSize());
+        result.setInitiatePingDisabled(initiatePingDisabled);
         return result;
     }
 
@@ -269,4 +270,9 @@ public class Http2Protocol implements Up
     public int getMaxTrailerSize() {
         return maxTrailerSize;
     }
+
+
+    public void setInitiatePingDisabled(boolean initiatePingDisabled) {
+        this.initiatePingDisabled = initiatePingDisabled;
+    }
 }

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=1788554&r1=1788553&r2=1788554&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java Fri Mar 
24 22:47:41 2017
@@ -1264,6 +1264,11 @@ class Http2UpgradeHandler extends Abstra
     }
 
 
+    public void setInitiatePingDisabled(boolean initiatePingDisabled) {
+        pingManager.initiateDisabled = initiatePingDisabled;
+    }
+
+
     // ----------------------------------------------- Http2Parser.Input 
methods
 
     @Override
@@ -1512,6 +1517,8 @@ class Http2UpgradeHandler extends Abstra
 
     protected class PingManager {
 
+        protected boolean initiateDisabled = false;
+
         // 10 seconds
         protected final long pingIntervalNano = 10000000000L;
 
@@ -1529,6 +1536,9 @@ class Http2UpgradeHandler extends Abstra
          * @throws IOException If an I/O issue prevents the ping from being 
sent
          */
         public void sendPing(boolean force) throws IOException {
+            if (initiateDisabled) {
+                return;
+            }
             long now = System.nanoTime();
             if (force || now - lastPingNanoTime > pingIntervalNano) {
                 lastPingNanoTime = now;



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

Reply via email to