Skip to content

Conversation

@Niaobu
Copy link
Contributor

@Niaobu Niaobu commented Jun 6, 2025

Bug description

Setup

Unity client connecting to C# server
Unity client changes network (wifi/mobile etc)
Server has AllowPeerAddressChange = true and UseNativeSockets = true

I was experiencing that the server notices the address change but the client does not receive packets after the PeerNotFound packets.

The order of operations was different in the constructor and FinishEndPointChange, causing the NativeAddress to be set using the old _cachedSocketAddr. The NetPeer looks like it is sending to the new client IP/port, but is actually still using the old one.

Change

Reordered _cachedSocketAddr assignment to occur before NativeAddress population, ensuring NativeAddress contains updated endpoint data rather than stale data during successful endpoint changes.

Reordered _cachedSocketAddr assignment to occur before NativeAddress
population, ensuring NativeAddress contains updated endpoint data
rather than stale data during successful endpoint changes.
@RevenantX RevenantX merged commit 10f5050 into RevenantX:master Jun 6, 2025
1 check passed
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