com.unity.netcode.gameobjects icon indicating copy to clipboard operation
com.unity.netcode.gameobjects copied to clipboard

Connection Approval timeout does not work on client-side

Open JesseOlmer opened this issue 3 years ago • 1 comments

Description

NetworkManager.ApprovalTimeout() is called during the connection process on clients, but will always no-op because NetworkManager.PendingClients is not populated on the client.

ApprovalTimeout Coroutine Invoke: https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/blob/develop/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs#L1505

PendingClients conditional: https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/blob/develop/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs#L1427 https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/blob/develop/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs#L1432

See also #1927

Reproduce Steps

  1. Put a breakpoint in NetworkManager.HandleApproval
  2. Attach debugger to a client (I used testproject)
  3. Connect the client to a server
  4. Step through and observe empty PendingClients list

Actual Outcome

The approval timeout coroutine early-outs immediately on the client

Expected Outcome

Either the timeout is not invoked on a client (risky?) or it properly monitors the pending connection status of the client.

Environment

  • OS: macOS
  • Unity Version: 2020.3.33f1
  • Netcode Version: develop latest
  • Netcode Commit: https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/commit/309ad7fd426bdab6b7fa8ab794588662d0cf52bc

Additional Context

It looks like this has been broken for a very long time. I believe at one point we had clients adding themselves to the pendingclients list locally, but I haven't been able to find when that was or when/why it would have been removed. All started from this slack thread: https://unity.slack.com/archives/C01JHPY05T5/p1651612938951379

JesseOlmer avatar May 03 '22 23:05 JesseOlmer

MTT-3451

ashwinimurt avatar May 03 '22 23:05 ashwinimurt