Skip to content

lib: Add recv_stop_sending callback - #2210

Merged
tatsuhiro-t merged 2 commits into
ngtcp2:mainfrom
httptoolkit:stop-sending-callback
Jun 11, 2026
Merged

tatsuhiro-t merged 2 commits into
ngtcp2:mainfrom
httptoolkit:stop-sending-callback

Conversation

@pimterry

@pimterry pimterry commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

This adds a new optional callback, which fires when a remote STOP_SENDING frame is received.

Until now, the only way to observe this was detecting the SHUT_WR error on the next write. That's a bit limiting in itself, but also may never happen for streams that are blocked by flow control, if the application deschedules them and waits for extend_max_stream_data to resume writing. With this callback it's easy for applications to clean up stopped streams immediately instead.

I've tried to mirror the equivalent callback for received RESET_STREAM here. This is my first contribution to ngtcp2 directly, and this is a bit outside my normal area, so do let me know if I've missed something in the process here.

This is a new optional callback that fires when a remote STOP_SENDING
frame is received. Until now, the only way to observe this was detecting
the SHUT_WR error on the next write - which would never happen for
streams blocked by flow control.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new callback, recv_stop_sending, which is triggered when a STOP_SENDING frame is received from a remote endpoint. To support this, the callback version has been bumped to NGTCP2_CALLBACKS_V4, and the ngtcp2_callbacks struct has been updated. The implementation includes helper functions to invoke the callback and comprehensive unit tests to verify its behavior under various conditions, such as duplicate frames and non-existent streams. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread tests/ngtcp2_conn_test.c Resolved
@tatsuhiro-t tatsuhiro-t added this to the v1.24.0 milestone Jun 11, 2026
@tatsuhiro-t
tatsuhiro-t merged commit 97b2dc1 into ngtcp2:main Jun 11, 2026
37 checks passed
@tatsuhiro-t

Copy link
Copy Markdown
Member

Thank you for PR. Merged now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants