Add on_writable/dmtcp_send_space() send-side backpressure - #1
Merged
Conversation
dmtcp_send() short-writes once the 4 KB per-connection outbound buffer fills, but nothing signalled when an ACK freed room again - so any sender of a payload larger than the buffer (a file, a firmware image) had to poll on its own timer or thread, blind to the one event that matters. dmtcp_writable_handler_t is edge-triggered like POSIX EPOLLOUT: a short dmtcp_send() arms conn->writable_pending, the next space-reclaiming ACK fires the callback once and disarms it. A caller that never fills the buffer is never woken. dmtcp_send_space() reports the current free room so a handler can size its next chunk without calling back in. Delivery order within a segment is on_data -> on_writable -> terminal callback, and the callback is invoked after conn->lock is released, the same discipline every other callback here follows. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dmtcp_send() short-writes once the 4 KB per-connection outbound buffer fills, but nothing signalled when an ACK freed room again - so any sender of a payload larger than the buffer (a file, a firmware image) had to poll on its own timer or thread, blind to the one event that matters.
dmtcp_writable_handler_t is edge-triggered like POSIX EPOLLOUT: a short dmtcp_send() arms conn->writable_pending, the next space-reclaiming ACK fires the callback once and disarms it. A caller that never fills the buffer is never woken. dmtcp_send_space() reports the current free room so a handler can size its next chunk without calling back in.
Delivery order within a segment is on_data -> on_writable -> terminal callback, and the callback is invoked after conn->lock is released, the same discipline every other callback here follows.