You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2016/12/14 20:19:33 UTC

svn commit: r1774336 - /httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java

Author: olegk
Date: Wed Dec 14 20:19:33 2016
New Revision: 1774336

URL: http://svn.apache.org/viewvc?rev=1774336&view=rev
Log:
 Work-around for what appears to be a bug in Ngnix 1.11

Modified:
    httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java?rev=1774336&r1=1774335&r2=1774336&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java Wed Dec 14 20:19:33 2016
@@ -171,8 +171,16 @@ abstract class AbstractHttp2StreamMultip
     private int updateWindow(final AtomicInteger window, final int delta) throws ArithmeticException {
         for (;;) {
             final int current = window.get();
-            final long newValue = (long) current + delta;
-            if (Math.abs(newValue) > Integer.MAX_VALUE) {
+            long newValue = (long) current + delta;
+
+            //TODO: work-around for what looks like a bug in Ngnix (1.11)
+            // Tolerate if the update window exceeded by one
+            if (newValue == 0x80000000L) {
+                newValue = Integer.MAX_VALUE;
+            }
+            //TODO: needs to be removed
+
+            if (Math.abs(newValue) > 0x7fffffffL) {
                 throw new ArithmeticException("Update causes flow control window to exceed " + Integer.MAX_VALUE);
             }
             if (window.compareAndSet(current, (int) newValue)) {