Repository navigation
Sockets: align the WinSocket backends' send() semantics - #1829
Merged
Merged
Conversation
Two residuals of the cross-backend send() inconsistency: - The WinSocket client returned on the first partial ::send() call (mid-block), while the POSIX and Qt backends keep sending until everything is written, the deadline elapses, or close() cancels the send. It now advances and loops like them; the loop condition re-checks the deadline and the state each iteration, so the cancellation and deadline behavior is unchanged. - The WinSocket server passed the raw payload length to ::send(), which takes an int: a payload larger than 2 GiB wrapped the length negative. It now chunks the send at 1 GiB, the same cap the WinSocket client already uses.
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.
Follow-up to the send()-deadline work (#1825/#1826): the two remaining
send()inconsistencies between the WinSocket backend and the POSIX/Qt backends (F4 residuals from the TCP audit).What changed
ClientSocket_WinSocket.cpp):send()returned on the first partial::send()call, while POSIX/Qt loop until everything is written, the deadline elapses, orclose()cancels the send. It now advances and loops like them. The loop condition already re-checks the deadline and the state each iteration, so deadline/cancel behavior is unchanged; only "give up on the first partial block" goes away. In practice this only affects payloads that don't fit in one::send()call (the 4096-byte protocol frames always did).ServerSocket_WinSocket.cpp):send()passed the raw payload length to::send(), which takes anint— a payload > 2 GiB wrapped the length negative. It now chunks at 1 GiB, the sameBLOCK_SIZEthe WinSocket client already used.Testing
No new test: the alignment is behavior-preserving for everything the existing tests exercise, and the 2 GiB case would need a 2 GiB allocation just to hit the cast. Both changes are covered by the existing deadline/send-close tests in CI (Windows runs the WinSocket backend). No changes to the send/close race, the deadline tests, or the POSIX/Qt backends.