src/java.net.http/share/classes/jdk/internal/net/http/WindowController.java
changeset 51232 ad1fa1db73d9
parent 49765 ee6f7a61f3a5
child 56842 43c3b82728eb
equal deleted inserted replaced
51231:1d8b1d4eae6a 51232:ad1fa1db73d9
   244                 // The stream may have been cancelled.
   244                 // The stream may have been cancelled.
   245                 if (debug.on())
   245                 if (debug.on())
   246                     debug.log("WARNING: No entry found for streamid: %s. May be cancelled?",
   246                     debug.log("WARNING: No entry found for streamid: %s. May be cancelled?",
   247                               streamid);
   247                               streamid);
   248             } else {
   248             } else {
   249                 size += amount;
   249                 int prev = size;
   250                 if (size < 0)
   250                 size = prev + amount;
       
   251                 if (size < prev)
   251                     return false;
   252                     return false;
   252                 streams.put(streamid, size);
   253                 streams.put(streamid, size);
   253                 if (debug.on())
   254                 if (debug.on())
   254                     debug.log("Stream %s window size is now %s (amount added %d)",
   255                     debug.log("Stream %s window size is now %s (amount added %d)",
   255                               streamid, size, amount);
   256                               streamid, size, amount);
   312         } finally {
   313         } finally {
   313             controllerLock.unlock();
   314             controllerLock.unlock();
   314         }
   315         }
   315     }
   316     }
   316 
   317 
   317 //    /** Returns the Send Window size for the given stream. */
   318     /** Returns the Send Window size for the given stream. */
   318 //    int streamWindowSize(int streamid) {
   319     int streamWindowSize(int streamid) {
   319 //        controllerLock.lock();
   320         controllerLock.lock();
   320 //        try {
   321         try {
   321 //            Integer size = streams.get(streamid);
   322             Integer size = streams.get(streamid);
   322 //            if (size == null)
   323             if (size == null)
   323 //                throw new InternalError("Expected entry for streamid: " + streamid);
   324                 throw new InternalError("Expected entry for streamid: " + streamid);
   324 //            return size;
   325             return size;
   325 //        } finally {
   326         } finally {
   326 //            controllerLock.unlock();
   327             controllerLock.unlock();
   327 //        }
   328         }
   328 //    }
   329     }
   329 
   330 
   330 }
   331 }