Connection Approval timeout does not work on client-side
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
- Put a breakpoint in
NetworkManager.HandleApproval - Attach debugger to a client (I used
testproject) - Connect the client to a server
- 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