You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I told previously (#3784 - ServerChangeScene sends NotReadyMessage to non-authenticated-yet connections), I'm rewriting the way my game loads and connects to servers. Now I call StartHost() and immediately after it I call ServerChangeScene() (no online scene set). This should work fine, though there was a problem with NotReadyMessage in an older version of Mirror. I've made a local fix to not update Mirror now, but noticed another problem.
As the title said, any messages sent in NetworkAuthenticator.OnClientAuthenticate() are just ignored. I send a RequestMessage there to authenticate. However as I see, StartHost() doesn't immediately authenticates the local client. StartHost() calls FinishStartHost() (because there's no online scene set), then it calls HostMode.InvokeOnConnected(), and it does this: ((LocalConnectionToServer)NetworkClient.connection).QueueConnectedEvent(). That connected event would be called in the next Update of the LocalConnectionToServer():
internaloverridevoid Update(){base.Update();// should we still process a connected event?if(connectedEventPending){connectedEventPending=false;
NetworkClient.OnConnectedEvent?.Invoke();}
OnConnectedEvent then calls NetworkManager.OnClientConnectInternal(), which then calls authenticator.OnClientAuthenticate() (if we have an authenticator, we do have) finally.
The problem: The update of the local client won't be called immediately, but ServerChangeScene() will be. It will set isLoadingScene to true on the server and... NetworkServer.OnTransportData() will be called:
// LocalConnectionToServer.csinternaloverridevoid Update(){base.Update();// should we still process a connected event?if(connectedEventPending&&!NetworkServer.isLoadingScene){connectedEventPending=false;
NetworkClient.OnConnectedEvent?.Invoke();}
Describe the bug
I told previously (#3784 - ServerChangeScene sends NotReadyMessage to non-authenticated-yet connections), I'm rewriting the way my game loads and connects to servers. Now I call StartHost() and immediately after it I call ServerChangeScene() (no online scene set). This should work fine, though there was a problem with NotReadyMessage in an older version of Mirror. I've made a local fix to not update Mirror now, but noticed another problem.
As the title said, any messages sent in NetworkAuthenticator.OnClientAuthenticate() are just ignored. I send a RequestMessage there to authenticate. However as I see, StartHost() doesn't immediately authenticates the local client. StartHost() calls FinishStartHost() (because there's no online scene set), then it calls HostMode.InvokeOnConnected(), and it does this: ((LocalConnectionToServer)NetworkClient.connection).QueueConnectedEvent(). That connected event would be called in the next Update of the LocalConnectionToServer():
OnConnectedEvent then calls NetworkManager.OnClientConnectInternal(), which then calls authenticator.OnClientAuthenticate() (if we have an authenticator, we do have) finally.
The problem: The update of the local client won't be called immediately, but ServerChangeScene() will be. It will set isLoadingScene to true on the server and... NetworkServer.OnTransportData() will be called:
Yes, this will completely ignore any authentication messages sent in NetworkAuthenticator.OnClientAuthenticate().
[IMPORTANT] How can we reproduce the issue, step by step:
Expected behavior
Messages sent in OnClientAuthenticate() should be handled by the server.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: