Home / Function/ updateSendWindowSize() — netty Function Reference

updateSendWindowSize() — netty Function Reference

Architecture documentation for the updateSendWindowSize() function in SpdySessionHandler.java from the netty codebase.

Function java Buffer Allocators calls 2 called by 2

Entity Profile

Dependency Diagram

graph TD
  0bbd9d3a_603a_1f42_0a30_c790b2a786c5["updateSendWindowSize()"]
  1fb79984_fd8e_cecc_3934_20ed3529f561["SpdySessionHandler"]
  0bbd9d3a_603a_1f42_0a30_c790b2a786c5 -->|defined in| 1fb79984_fd8e_cecc_3934_20ed3529f561
  d2ae1d21_cf0c_c4d0_e046_efc746940057["channelRead()"]
  d2ae1d21_cf0c_c4d0_e046_efc746940057 -->|calls| 0bbd9d3a_603a_1f42_0a30_c790b2a786c5
  ec4cd550_8624_c011_7fc2_e23fed71bcc1["handleOutboundMessage()"]
  ec4cd550_8624_c011_7fc2_e23fed71bcc1 -->|calls| 0bbd9d3a_603a_1f42_0a30_c790b2a786c5
  d9e20c4c_0d4b_8b85_52cd_ff50b2c773f1["issueSessionError()"]
  0bbd9d3a_603a_1f42_0a30_c790b2a786c5 -->|calls| d9e20c4c_0d4b_8b85_52cd_ff50b2c773f1
  fd4b4a14_de0e_f563_d7f8_c8f51694e4f6["halfCloseStream()"]
  0bbd9d3a_603a_1f42_0a30_c790b2a786c5 -->|calls| fd4b4a14_de0e_f563_d7f8_c8f51694e4f6
  style 0bbd9d3a_603a_1f42_0a30_c790b2a786c5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java lines 744–798

    private void updateSendWindowSize(final ChannelHandlerContext ctx, int streamId, int deltaWindowSize) {
        spdySession.updateSendWindowSize(streamId, deltaWindowSize);

        while (true) {
            // Check if we have unblocked a stalled stream
            SpdySession.PendingWrite pendingWrite = spdySession.getPendingWrite(streamId);
            if (pendingWrite == null) {
                return;
            }

            SpdyDataFrame spdyDataFrame = pendingWrite.spdyDataFrame;
            int dataFrameSize = spdyDataFrame.content().readableBytes();
            int writeStreamId = spdyDataFrame.streamId();
            int sendWindowSize = spdySession.getSendWindowSize(writeStreamId);
            int sessionSendWindowSize = spdySession.getSendWindowSize(SPDY_SESSION_STREAM_ID);
            sendWindowSize = Math.min(sendWindowSize, sessionSendWindowSize);

            if (sendWindowSize <= 0) {
                return;
            } else if (sendWindowSize < dataFrameSize) {
                // We can send a partial frame
                spdySession.updateSendWindowSize(writeStreamId, -1 * sendWindowSize);
                spdySession.updateSendWindowSize(SPDY_SESSION_STREAM_ID, -1 * sendWindowSize);

                // Create a partial data frame whose length is the current window size
                SpdyDataFrame partialDataFrame = new DefaultSpdyDataFrame(
                        writeStreamId, spdyDataFrame.content().readRetainedSlice(sendWindowSize));

                // The transfer window size is pre-decremented when sending a data frame downstream.
                ctx.writeAndFlush(partialDataFrame).addListener(future -> {
                    if (!future.isSuccess()) {
                        issueSessionError(ctx, SpdySessionStatus.INTERNAL_ERROR);
                    }
                });
            } else {
                // Window size is large enough to send entire data frame
                spdySession.removePendingWrite(writeStreamId);
                spdySession.updateSendWindowSize(writeStreamId, -1 * dataFrameSize);
                spdySession.updateSendWindowSize(SPDY_SESSION_STREAM_ID, -1 * dataFrameSize);

                // Close the local side of the stream if this is the last frame
                if (spdyDataFrame.isLast()) {
                    halfCloseStream(writeStreamId, false, pendingWrite.promise);
                }

                // The transfer window size is pre-decremented when sending a data frame downstream.
                // Close the session on write failures that leave the transfer window in a corrupt state.
                ctx.writeAndFlush(spdyDataFrame, pendingWrite.promise).addListener(future -> {
                    if (!future.isSuccess()) {
                        issueSessionError(ctx, SpdySessionStatus.INTERNAL_ERROR);
                    }
                });
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does updateSendWindowSize() do?
updateSendWindowSize() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java.
Where is updateSendWindowSize() defined?
updateSendWindowSize() is defined in codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java at line 744.
What does updateSendWindowSize() call?
updateSendWindowSize() calls 2 function(s): halfCloseStream, issueSessionError.
What calls updateSendWindowSize()?
updateSendWindowSize() is called by 2 function(s): channelRead, handleOutboundMessage.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free