mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
parent
5fee51ada0
commit
6c5934f731
@ -13,6 +13,9 @@ public class BasicAuthenticator : NetworkAuthenticator
|
||||
public string username;
|
||||
public string password;
|
||||
|
||||
// this is set if authentication fails to prevent garbage AuthRequestMessage spam
|
||||
bool ServerAuthFailed;
|
||||
|
||||
#region Messages
|
||||
|
||||
public struct AuthRequestMessage : NetworkMessage
|
||||
@ -101,7 +104,13 @@ public void OnAuthRequestMessage(NetworkConnection conn, AuthRequestMessage msg)
|
||||
conn.isAuthenticated = false;
|
||||
|
||||
// disconnect the client after 1 second so that response message gets delivered
|
||||
StartCoroutine(DelayedDisconnect(conn, 1));
|
||||
if (!ServerAuthFailed)
|
||||
{
|
||||
// set this false so this coroutine can only be started once
|
||||
ServerAuthFailed = true;
|
||||
|
||||
StartCoroutine(DelayedDisconnect(conn, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user