@Override public int id() { Http2Stream stream = this.stream; return stream == null ? id : stream.id(); }
int id() { return stream.id(); }
DefaultHttp2FrameStream setStreamAndProperty(PropertyKey streamKey, Http2Stream stream) { assert id == -1 || stream.id() == id; this.stream = stream; stream.setProperty(streamKey, this); return this; }
@Override public int id() { Http2Stream stream = this.stream; return stream == null ? id : stream.id(); }
void writeReset(long code) { conn.handler.writeReset(stream.id(), code); }
/** * Increments the flow control window for this stream by the given delta and returns the new value. */ int incrementStreamWindow(int delta) throws Http2Exception { if (delta > 0 && Integer.MAX_VALUE - delta < window) { throw streamError(stream.id(), FLOW_CONTROL_ERROR, "Window size overflow for stream: %d", stream.id()); } window += delta; streamByteDistributor.updateStreamableBytes(this); return window; }
@Override public void onStreamAdded(Http2Stream stream) { if (frameStreamToInitialize != null && stream.id() == frameStreamToInitialize.id()) { frameStreamToInitialize.setStreamAndProperty(streamKey, stream); frameStreamToInitialize = null; } }
void onStreamWritabilityChanged(Http2Stream s) { VertxHttp2Stream stream; synchronized (this) { stream = streams.get(s.id()); } if (stream != null) { context.executeFromIO(v -> stream.onWritabilityChanged()); } }
NetSocket toNetSocket(VertxHttp2Stream stream) { VertxHttp2NetSocket<Http2ConnectionBase> rempl = new VertxHttp2NetSocket<>(this, stream.stream, !stream.isNotWritable()); streams.put(stream.stream.id(), rempl); return rempl; }
private void _writeFrame(Http2Stream stream, byte type, short flags, ByteBuf payload) { encoder().writeFrame(chctx, type, stream.id(), new Http2Flags(flags), payload, chctx.newPromise()); chctx.flush(); }
DefaultHttp2FrameStream setStreamAndProperty(PropertyKey streamKey, Http2Stream stream) { assert id == -1 || stream.id() == id; this.stream = stream; stream.setProperty(streamKey, this); return this; }
private void _writePriority(Http2Stream stream, int streamDependency, short weight, boolean exclusive) { encoder().writePriority(chctx, stream.id(), streamDependency, weight, exclusive, chctx.newPromise()); }
private void _writeHeaders(Http2Stream stream, Http2Headers headers, boolean end, int streamDependency, short weight, boolean exclusive) { encoder().writeHeaders(chctx, stream.id(), headers, streamDependency, weight, exclusive, 0, end, chctx.newPromise()); }
void onStreamClosed(Http2Stream stream) { VertxHttp2Stream removed; synchronized (this) { removed = streams.remove(stream.id()); if (removed == null) { return; } } context.executeFromIO(v -> removed.handleClose()); checkShutdownHandler(); }
private Http2ClientStream createStream(Http2Stream stream) { boolean writable = handler.encoder().flowController().isWritable(stream); Http2ClientStream clientStream = new Http2ClientStream(this, stream, writable); streams.put(clientStream.stream.id(), clientStream); return clientStream; }
@Override public void onStreamAdded(Http2Stream stream) { if (frameStreamToInitialize != null && stream.id() == frameStreamToInitialize.id()) { frameStreamToInitialize.setStreamAndProperty(streamKey, stream); frameStreamToInitialize = null; } }
private void onStreamActive0(Http2Stream stream) { if (connection().local().isValidStreamId(stream.id())) { return; } DefaultHttp2FrameStream stream2 = newStream().setStreamAndProperty(streamKey, stream); onHttp2StreamStateChanged(ctx, stream2); }
private void _writeData(Http2Stream stream, ByteBuf chunk, boolean end, ChannelPromise promise) { encoder().writeData(chctx, stream.id(), chunk, 0, end, promise); Http2RemoteFlowController controller = encoder().flowController(); if (!controller.isWritable(stream) || end) { try { encoder().flowController().writePendingBytes(); } catch (Http2Exception e) { onError(chctx, true, e); } } chctx.channel().flush(); }
private void onStreamActive0(Http2Stream stream) { if (connection().local().isValidStreamId(stream.id())) { return; } DefaultHttp2FrameStream stream2 = newStream().setStreamAndProperty(streamKey, stream); onHttp2StreamStateChanged(ctx, stream2); }