Conversation
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.
Addresses review finding R32.
SocketTransportconfigured withmaxPacketSizeof 1, 2, or 3 currently permits payloads up to four bytes because validation uses the receive buffer's minimum header capacity. Store the configured payload maximum separately and use it for both outgoing message validation and incoming frame lengths. Keep enough buffer capacity for the four-byte header.Oversized sends throw before writing a frame, and oversized incoming headers disconnect the transport before waiting for a body or delivering a message. The tests cover each small limit, both header-only and complete oversized frames, empty and exact-limit round trips after a rejected send, and four/eight-byte limit controls. The public constructor still accepts a
uintand rejects zero and values aboveint.MaxValue; the framing format is unchanged.Validation on Windows with .NET SDK 10.0.400 and the .NET 8 runtime:
37f4e1ffb1d7fc3e7bcdea3dfbbd4484f9fe7516produced 9 failures and 12 passes in the focused transport suite. The failures independently reproduce outgoing acceptance, incoming delivery, and waiting for bodies after oversized headers at limits 1–3.SocketTransportTestscases pass, including constructor controls for zero,int.MaxValue + 1, anduint.MaxValue.MemoryRelayTransport.cs:21CS8600 warning remains. The separate analyzer/generator test projects were not rerun for this runtime-only change.git diff --checkpasses. Linux socket behavior and allocation of near-int.MaxValuebuffers were not exercised.This PR is based directly on
rewriteat37f4e1ffb1d7fc3e7bcdea3dfbbd4484f9fe7516and covers R32. R1 / PR #5 separately changes the receive loop to read incrementally and detect EOF. When combining the changes, retain this PR's configuredMaxPacketSizeand usepacketSize > MaxPacketSizein R1's updated receive loop after the complete header is decoded. R1's EOF and large-frame progress behavior is not implemented by this PR; the combined branch has not been tested here and should run both transport regression sets.