Skip to content

Add on_writable/dmtcp_send_space() send-side backpressure - #1

Merged
JohnAmadis merged 1 commit into
mainfrom
feature/on-writable
Jul 29, 2026
Merged

Add on_writable/dmtcp_send_space() send-side backpressure#1
JohnAmadis merged 1 commit into
mainfrom
feature/on-writable

Conversation

@JohnAmadis

Copy link
Copy Markdown
Contributor

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.

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>
@JohnAmadis
JohnAmadis merged commit 7aaa6d4 into main Jul 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants