Details
-
Improvement
-
Status: Closed
-
Trivial
-
Resolution: Information Provided
-
5.1
-
None
-
None
Description
I just read the update window logic for http2, and the function is a little confuse for me.
- for the two TODO: The first TODO, it revert the min value as to the the max value, this if for what situation?
- The seconde TODO: needs to be removed , and that will remove what?
The soure code in httpcore5-h2\src\main\java\org\apache\hc\core5\http2\impl\nio\AbstractH2StreamMultiplexer.java is as below:
private int updateWindow(final AtomicInteger window, final int delta) throws ArithmeticException {
for (; {
final int current = window.get();
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)
//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))
{ return (int) newValue; }}
}