[ 
https://issues.apache.org/jira/browse/HTTPCORE-701?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kaven Stone updated HTTPCORE-701:
---------------------------------
    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)

{ 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))

{ return (int) newValue; }

}
}

 

  was:
I just read the update window logic for http2, and the function is a little 
confuse for me.
 # why here should use the for (;;) here? what the purpose?
 # 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) {
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)) {
return (int) newValue;
}
}
}

 


> A little confuse for the H2 update window function
> --------------------------------------------------
>
>                 Key: HTTPCORE-701
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-701
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 5.1
>            Reporter: Kaven Stone
>            Priority: Trivial
>
> 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)
> { 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))
> { return (int) newValue; }
> }
> }
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to