private void incrementInputCapacity( final int streamId, final AtomicInteger inputWindow, final int inputCapacity) throws IOException { if (inputCapacity > 0) { final int streamWinSize = inputWindow.get(); final int remainingCapacity = Integer.MAX_VALUE - streamWinSize; final int chunk = Math.min(inputCapacity, remainingCapacity); final RawFrame windowUpdateFrame = frameFactory.createWindowUpdate(streamId, chunk); commitFrame(windowUpdateFrame); updateInputWindow(streamId, inputWindow, chunk); } }
final int delta = this.remoteConfig.getInitialWindowSize() - connWinSize; if (delta > 0) { final RawFrame windowUpdateFrame = frameFactory.createWindowUpdate(0, delta); commitFrame(windowUpdateFrame); updateInputWindow(0, connInputWindow, delta);
private void consumeDataFrame(final RawFrame frame, final Http2Stream stream) throws HttpException, IOException { final int streamId = stream.getId(); final ByteBuffer payload = frame.getPayloadContent(); if (payload != null) { final int frameLength = frame.getLength(); final int streamWinSize = updateInputWindow(streamId, stream.getInputWindow(), -frameLength); if (streamWinSize < lowMark && !stream.isRemoteClosed()) { stream.produceInputCapacityUpdate(); } final int connWinSize = updateInputWindow(0, connInputWindow, -frameLength); if (connWinSize < lowMark) { final int chunk = Integer.MAX_VALUE - connWinSize; if (chunk > 0) { final RawFrame windowUpdateFrame = frameFactory.createWindowUpdate(0, chunk); commitFrame(windowUpdateFrame); updateInputWindow(0, connInputWindow, chunk); } } } if (stream.isRemoteClosed()) { throw new H2StreamResetException(H2Error.STREAM_CLOSED, "Stream already closed"); } if (stream.isLocalReset()) { return; } if (frame.isFlagSet(FrameFlag.END_STREAM)) { stream.setRemoteEndStream(); } stream.consumeData(payload); }