DarkRiftNetworking/DarkRift

Client ID sometimes assigned after ConnectionState is set to Connected

Opened this issue · 0 comments

Shii2 commented

Quick Description

Client ID sometimes assigned after ConnectionState is set to Connected that in rare cases can cause getting wrong ID.

Explanation

DarkRift should assign client ID before setting ConnectionState to Connected to prevent this issue.

For example if I connecting to server using ConnectInBackground method and somewhere in code I have coroutine waiting for connection like this:
while (_unityClient.ConnectionState != ConnectionState.Connected) yield return null;
In rare case if I try to get _unityClient.ID right after while loop ID might be wrong (still 0, not assigned)