checkNewStreamAllowed() — netty Function Reference
Architecture documentation for the checkNewStreamAllowed() function in DefaultHttp2Connection.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD facfc400_d7e3_bf1c_8873_e78842b4f8fc["checkNewStreamAllowed()"] 4fff0ad9_a79c_4bdb_3e93_54ee4440ca84["DefaultEndpoint"] facfc400_d7e3_bf1c_8873_e78842b4f8fc -->|defined in| 4fff0ad9_a79c_4bdb_3e93_54ee4440ca84 70d81cb4_4074_f43b_ccc8_18d7b3da8dc5["DefaultStream()"] 70d81cb4_4074_f43b_ccc8_18d7b3da8dc5 -->|calls| facfc400_d7e3_bf1c_8873_e78842b4f8fc 36dea6ba_23b3_cc56_baf0_358018c65dc1["isValidStreamId()"] facfc400_d7e3_bf1c_8873_e78842b4f8fc -->|calls| 36dea6ba_23b3_cc56_baf0_358018c65dc1 88dfd231_33bb_8529_db43_2bb61c56d210["canOpenStream()"] facfc400_d7e3_bf1c_8873_e78842b4f8fc -->|calls| 88dfd231_33bb_8529_db43_2bb61c56d210 be7f7706_f416_b2e7_a91c_8e2ec0829253["isClosed()"] facfc400_d7e3_bf1c_8873_e78842b4f8fc -->|calls| be7f7706_f416_b2e7_a91c_8e2ec0829253 style facfc400_d7e3_bf1c_8873_e78842b4f8fc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Connection.java lines 910–945
private void checkNewStreamAllowed(int streamId, State state) throws Http2Exception {
assert state != IDLE;
if (lastStreamKnownByPeer >= 0 && streamId > lastStreamKnownByPeer) {
throw streamError(streamId, REFUSED_STREAM,
"Cannot create stream %d greater than Last-Stream-ID %d from GOAWAY.",
streamId, lastStreamKnownByPeer);
}
if (!isValidStreamId(streamId)) {
if (streamId < 0) {
throw new Http2NoMoreStreamIdsException();
}
throw connectionError(PROTOCOL_ERROR, "Request stream %d is not correct for %s connection", streamId,
server ? "server" : "client");
}
// This check must be after all id validated checks, but before the max streams check because it may be
// recoverable to some degree for handling frames which can be sent on closed streams.
if (streamId < nextStreamIdToCreate) {
throw closedStreamError(PROTOCOL_ERROR, "Request stream %d is behind the next expected stream %d",
streamId, nextStreamIdToCreate);
}
if (nextStreamIdToCreate <= 0) {
// We exhausted the stream id space that we can use. Let's signal this back but also signal that
// we still may want to process active streams.
throw new Http2Exception(REFUSED_STREAM, "Stream IDs are exhausted for this endpoint.",
Http2Exception.ShutdownHint.GRACEFUL_SHUTDOWN);
}
boolean isReserved = state == RESERVED_LOCAL || state == RESERVED_REMOTE;
if (!isReserved && !canOpenStream() || isReserved && numStreams >= maxStreams) {
throw streamError(streamId, REFUSED_STREAM, "Maximum active streams violated for this endpoint: " +
(isReserved ? maxStreams : maxActiveStreams));
}
if (isClosed()) {
throw connectionError(INTERNAL_ERROR, "Attempted to create stream id %d after connection was closed",
streamId);
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does checkNewStreamAllowed() do?
checkNewStreamAllowed() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Connection.java.
Where is checkNewStreamAllowed() defined?
checkNewStreamAllowed() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Connection.java at line 910.
What does checkNewStreamAllowed() call?
checkNewStreamAllowed() calls 3 function(s): canOpenStream, isClosed, isValidStreamId.
What calls checkNewStreamAllowed()?
checkNewStreamAllowed() is called by 1 function(s): DefaultStream.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free