Skip to content
This repository was archived by the owner on Sep 5, 2022. It is now read-only.

Commit f988f2d

Browse files
committed
Mirror 41
1 parent 68ad564 commit f988f2d

File tree

714 files changed

+3290
-11536
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

714 files changed

+3290
-11536
lines changed

UnityProject/Assets/Mirror/Authenticators.meta

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityProject/Assets/Mirror/Authenticators/BasicAuthenticator.cs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ public class BasicAuthenticator : NetworkAuthenticator
1313
public string username;
1414
public string password;
1515

16+
// this is set if authentication fails to prevent garbage AuthRequestMessage spam
17+
bool ServerAuthFailed;
18+
1619
#region Messages
1720

1821
public struct AuthRequestMessage : NetworkMessage
@@ -101,7 +104,13 @@ public void OnAuthRequestMessage(NetworkConnection conn, AuthRequestMessage msg)
101104
conn.isAuthenticated = false;
102105

103106
// disconnect the client after 1 second so that response message gets delivered
104-
StartCoroutine(DelayedDisconnect(conn, 1));
107+
if (!ServerAuthFailed)
108+
{
109+
// set this false so this coroutine can only be started once
110+
ServerAuthFailed = true;
111+
112+
StartCoroutine(DelayedDisconnect(conn, 1));
113+
}
105114
}
106115
}
107116

@@ -140,22 +149,23 @@ public override void OnStopClient()
140149
/// <summary>
141150
/// Called on client from OnClientAuthenticateInternal when a client needs to authenticate
142151
/// </summary>
143-
/// <param name="conn">Connection of the client.</param>
144-
public override void OnClientAuthenticate(NetworkConnection conn)
152+
public override void OnClientAuthenticate()
145153
{
146154
AuthRequestMessage authRequestMessage = new AuthRequestMessage
147155
{
148156
authUsername = username,
149157
authPassword = password
150158
};
151159

152-
conn.Send(authRequestMessage);
160+
NetworkClient.connection.Send(authRequestMessage);
153161
}
154162

163+
[Obsolete("Call OnAuthResponseMessage without the NetworkConnection parameter. It always points to NetworkClient.connection anyway.")]
164+
public void OnAuthResponseMessage(NetworkConnection conn, AuthResponseMessage msg) => OnAuthResponseMessage(msg);
165+
155166
/// <summary>
156167
/// Called on client when the server's AuthResponseMessage arrives
157168
/// </summary>
158-
/// <param name="conn">Connection to client.</param>
159169
/// <param name="msg">The message payload</param>
160170
public void OnAuthResponseMessage(AuthResponseMessage msg)
161171
{
@@ -164,20 +174,17 @@ public void OnAuthResponseMessage(AuthResponseMessage msg)
164174
// Debug.LogFormat(LogType.Log, "Authentication Response: {0}", msg.message);
165175

166176
// Authentication has been accepted
167-
ClientAccept(NetworkClient.connection);
177+
ClientAccept();
168178
}
169179
else
170180
{
171181
Debug.LogError($"Authentication Response: {msg.message}");
172182

173183
// Authentication has been rejected
174-
ClientReject(NetworkClient.connection);
184+
ClientReject();
175185
}
176186
}
177187

178-
[Obsolete("Call OnAuthResponseMessage without the NetworkConnection parameter. It always points to NetworkClient.connection anyway.")]
179-
public void OnAuthResponseMessage(NetworkConnection conn, AuthResponseMessage msg) => OnAuthResponseMessage(msg);
180-
181188
#endregion
182189
}
183190
}

UnityProject/Assets/Mirror/Authenticators/BasicAuthenticator.cs.meta

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityProject/Assets/Mirror/Authenticators/Mirror.Authenticators.asmdef.meta

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityProject/Assets/Mirror/Authenticators/TimeoutAuthenticator.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,21 @@ public override void OnServerAuthenticate(NetworkConnection conn)
4848
StartCoroutine(BeginAuthentication(conn));
4949
}
5050

51-
public override void OnClientAuthenticate(NetworkConnection conn)
51+
public override void OnClientAuthenticate()
5252
{
53-
authenticator.OnClientAuthenticate(conn);
53+
authenticator.OnClientAuthenticate();
5454
if (timeout > 0)
55-
StartCoroutine(BeginAuthentication(conn));
55+
StartCoroutine(BeginAuthentication(NetworkClient.connection));
5656
}
5757

5858
IEnumerator BeginAuthentication(NetworkConnection conn)
5959
{
6060
// Debug.Log($"Authentication countdown started {conn} {timeout}");
61-
6261
yield return new WaitForSecondsRealtime(timeout);
6362

6463
if (!conn.isAuthenticated)
6564
{
6665
// Debug.Log($"Authentication Timeout {conn}");
67-
6866
conn.Disconnect();
6967
}
7068
}

UnityProject/Assets/Mirror/Authenticators/TimeoutAuthenticator.cs.meta

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityProject/Assets/Mirror/Cloud/ApiConnector.cs

Lines changed: 0 additions & 61 deletions
This file was deleted.

UnityProject/Assets/Mirror/Cloud/Core.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

UnityProject/Assets/Mirror/Cloud/Core/BaseApi.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

UnityProject/Assets/Mirror/Cloud/Core/Events.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)