Skip to content

Fix reliable message loss during UDP connection initialization - #75

Open
NikoCat233 wants to merge 1 commit into
willardf:mainfrom
NikoCat233:fix/udp-connection-initialization
Open

NikoCat233 wants to merge 1 commit into
willardf:mainfrom
NikoCat233:fix/udp-connection-initialization

Conversation

@NikoCat233

Copy link
Copy Markdown

UDP listeners publish new connections before NewConnection returns. A retransmitted Hello can therefore be acknowledged by another thread while initialization is still running. The client then connects and sends reliable data, which can be acknowledged and discarded before DataReceived is subscribed.

Gate Hello and application packets until initialization completes, without acknowledging them or advancing reliable receive state. Continue processing ACKs and disconnects, and avoid acknowledging the original Hello if the connection was closed during initialization. Apply the fix to both UDP listeners without changing the wire protocol.

Add eight regression cases covering handshake retries, reliable delivery, independent connection progress, outbound ACKs, and disconnects. Also correct the packet capture helper's queue wait condition to prevent stale ACK assertions.

Validation:

  • Original upstream with the new tests: six expected failures and two passes.
  • Fixed regression tests: 8/8 passed in Debug and Release.
  • Full Debug/net472 suite: 171/171 passed.
  • Release/netstandard2.0 build: passed with six existing warnings.

Prevent retried Hello and application packets from being processed
before NewConnection finishes, while allowing ACKs and disconnects.

Add regression tests for both UDP listeners and fix the packet
capture helper's queue synchronization.
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.

1 participant