You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A failed flush keeps references the echo pattern then overwrites #6
flush leaves the batch staged when sendmmsg fails, by design (the existing
test TransmitBatch.AFailedFlushLeavesTheBatchStaged pins this). stage keeps
references to the caller's bytes, and the README and echo.cpp stage straight out
of receive slots.
In the echo loop, a failed flush is logged and the loop continues:
receive rearms and overwrites the slots the staged entries point into.
New datagrams are staged after the old entries.
The next flush sends the new peers' bytes to the old peers' addresses.
sendmmsg fails only when the first entry fails. A per-destination error that
repeats (EMSGSIZE, EPERM from netfilter, EACCES on broadcast, EHOSTUNREACH) therefore fails every later flush too. The batch never drains,
and one bad destination stops replies to everyone.
Proposed fix
Example and README: discard() on any flush error, or at least on errors other
than would_block, and say why in one line.
Library options, not mutually exclusive:
On an error other than EAGAIN, drop entry 0 and retry the rest in the same
call. Report the dropped entry through the result.
Document the lifetime precisely: referenced bytes must stay put until a flush succeeds or discard() runs, not just "until flush returns".
Reconsider whether "stays staged on failure" should be the default for batches
staged by reference.
Acceptance
A test where the first staged destination always fails shows the rest still go
out, or shows that the documented pattern recovers.
Activity