Skip to content

bufio: Fix splice counters on partial writes - #110

Merged
nekohasekai merged 1 commit into
SagerNet:mainfrom
xjetry:splice-count-partial-writes
Sep 20, 2026
Merged

nekohasekai merged 1 commit into
SagerNet:mainfrom
xjetry:splice-count-partial-writes

Conversation

@xjetry

@xjetry xjetry commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

When a Linux splice copy fails after a partial write, the current round's bytes are omitted from the counters and the returned byte count.

Count source reads when data enters the pipe, and count bytes written to the destination before returning a write error. The return value tracks bytes written.

Validation: Linux go test ./... and make lint for all five configured platforms pass. The new Linux socket-pair regression test fails on the old implementation and passes with the fix. go vet ./... reports the same three existing diagnostics with the unmodified main implementation.

@nekohasekai nekohasekai changed the title bufio: count the bytes already spliced when the copy is interrupted bufio: Fix splice counters on partial writes Sep 20, 2026
@nekohasekai
nekohasekai changed the base branch from dev to main September 20, 2026 03:14
@nekohasekai
nekohasekai force-pushed the splice-count-partial-writes branch from 899a1a8 to 39db160 Compare September 20, 2026 03:14
@nekohasekai
nekohasekai merged commit 0f86e07 into SagerNet:main Sep 20, 2026
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