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/12 13:19:55 UTC

svn commit: r1685066 - in /tomcat/trunk/java/org/apache/coyote/http2: AbstractStream.java LocalStrings.properties

Author: markt
Date: Fri Jun 12 11:19:55 2015
New Revision: 1685066

URL: http://svn.apache.org/r1685066
Log:
Add debug logging
Fix logic error in overflow protection

Modified:
    tomcat/trunk/java/org/apache/coyote/http2/AbstractStream.java
    tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties

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=1685066&r1=1685065&r2=1685066&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/AbstractStream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/AbstractStream.java Fri Jun 12 11:19:55 2015
@@ -19,11 +19,18 @@ package org.apache.coyote.http2;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.res.StringManager;
+
 /**
  * Used to managed prioritisation.
  */
 abstract class AbstractStream {
 
+    private static final Log log = LogFactory.getLog(AbstractStream.class);
+    private static final StringManager sm = StringManager.getManager(AbstractStream.class);
+
     private final Integer identifier;
 
     private volatile AbstractStream parentStream = null;
@@ -109,11 +116,15 @@ abstract class AbstractStream {
     protected void incrementWindowSize(int increment) throws Http2Exception {
         synchronized (windowSizeLock) {
             // Overflow protection
-            if (Long.MAX_VALUE - increment > windowSize) {
+            if (Long.MAX_VALUE - increment < windowSize) {
                 windowSize = Long.MAX_VALUE;
             } else {
                 windowSize += increment;
             }
+            if (log.isDebugEnabled()) {
+                log.debug(sm.getString("abstractStream.windowSizeInc", getConnectionId(),
+                        getIdentifier(), Integer.toString(increment), Long.toString(windowSize)));
+            }
         }
     }
 
@@ -124,6 +135,10 @@ abstract class AbstractStream {
         // decrements are permitted
         synchronized (windowSizeLock) {
             windowSize -= decrement;
+            if (log.isDebugEnabled()) {
+                log.debug(sm.getString("abstractStream.windowSizeDec", getConnectionId(),
+                        getIdentifier(), Integer.toString(decrement), Long.toString(windowSize)));
+            }
         }
     }
 

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=1685066&r1=1685065&r2=1685066&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties Fri Jun 12 11:19:55 2015
@@ -13,6 +13,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+abstractStream.windowSizeDec=Connection [{0}], Stream [{1}], reduce flow control window by [{2}] to [{3}]
+abstractStream.windowSizeInc=Connection [{0}], Stream [{1}], increase flow control window by [{2}] to [{3}]
+
 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}]



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