Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-701

A little confuse for the H2 update window function

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Information Provided
    • 5.1
    • None
    • HttpCore
    • None

    Description

      I just read the update window logic for http2, and the function is a little confuse for me.

      1. for the two TODO:  The first TODO, it revert the min value as to the the max value, this if for what situation?
      2. 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; }

      }
      }

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            StoneCity Kaven Stone
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: