/** * Closes the local side of the given stream. If this causes the stream to be closed, adds a * hook to close the channel after the given future completes. * * @param stream the stream to be half closed. * @param future If closing, the future after which to close the channel. */ @Override public void closeStreamLocal(Http2Stream stream, ChannelFuture future) { switch (stream.state()) { case HALF_CLOSED_LOCAL: case OPEN: stream.closeLocalSide(); break; default: closeStream(stream, future); break; } }
/** * Closes the local side of the given stream. If this causes the stream to be closed, adds a * hook to close the channel after the given future completes. * * @param stream the stream to be half closed. * @param future If closing, the future after which to close the channel. */ @Override public void closeStreamLocal(Http2Stream stream, ChannelFuture future) { switch (stream.state()) { case HALF_CLOSED_LOCAL: case OPEN: stream.closeLocalSide(); break; default: closeStream(stream, future); break; } }
/** * Closes the local side of the given stream. If this causes the stream to be closed, adds a * hook to close the channel after the given future completes. * * @param stream the stream to be half closed. * @param future If closing, the future after which to close the channel. */ @Override public void closeStreamLocal(Http2Stream stream, ChannelFuture future) { switch (stream.state()) { case HALF_CLOSED_LOCAL: case OPEN: stream.closeLocalSide(); break; default: closeStream(stream, future); break; } }
@Override public void onDataRead(Connection connection, Http2Stream stream, byte[] data, boolean endOfStream) { log.debug("receive data on connection {}, streamId {}", connection, stream.id()); StreamData streamData = getStreamData(connection, stream); if (streamData == null) { onStreamError(connection, stream, new IOException( connection.toString() + " received data frame on " + stream.id() + ", but headers hasn't received")); return; } streamData.addData(data); if (endOfStream) { onDataRead(connection, stream, streamData); stream.closeLocalSide(); } }
@Override public void onHeadersRead(Connection connection, Http2Stream stream, Http2Headers headers, boolean endOfStream) { PropertyKey key = connection.getPropertyKey(DATA_CACHE_KEY); StreamData streamData = getStreamData(connection, stream); if (streamData == null) { streamData = new StreamData(); stream.setProperty(key, streamData); } streamData.addHeaders(headers); if (endOfStream) { onDataRead(connection, stream, streamData); stream.closeLocalSide(); } }