Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 5 additions & 6 deletions Assets/Mirror/Authenticators/BasicAuthenticator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
Expand All @@ -17,7 +16,7 @@ public class BasicAuthenticator : NetworkAuthenticator
public string username;
public string password;

readonly HashSet<NetworkConnection> connectionsPendingDisconnect = new HashSet<NetworkConnection>();
readonly HashSet<NetworkConnectionToClient> connectionsPendingDisconnect = new HashSet<NetworkConnectionToClient>();

#region Messages

Expand Down Expand Up @@ -51,7 +50,7 @@ public override void OnStartServer()

/// <summary>
/// Called on server from StopServer to reset the Authenticator
/// <para>Server message handlers should be registered in this method.</para>
/// <para>Server message handlers should be unregistered in this method.</para>
/// </summary>
public override void OnStopServer()
{
Expand All @@ -60,7 +59,7 @@ public override void OnStopServer()
}

/// <summary>
/// Called on server from OnServerAuthenticateInternal when a client needs to authenticate
/// Called on server from OnServerConnectInternal when a client needs to authenticate
/// </summary>
/// <param name="conn">Connection to client.</param>
public override void OnServerAuthenticate(NetworkConnectionToClient conn)
Expand Down Expand Up @@ -153,7 +152,7 @@ public override void OnStopClient()
}

/// <summary>
/// Called on client from OnClientAuthenticateInternal when a client needs to authenticate
/// Called on client from OnClientConnectInternal when a client needs to authenticate
/// </summary>
public override void OnClientAuthenticate()
{
Expand All @@ -163,7 +162,7 @@ public override void OnClientAuthenticate()
authPassword = password
};

NetworkClient.connection.Send(authRequestMessage);
NetworkClient.Send(authRequestMessage);
}

/// <summary>
Expand Down
7 changes: 7 additions & 0 deletions Assets/Mirror/Authenticators/BasicAuthenticator.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Assets/Mirror/Authenticators/DeviceAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Mirror.Authenticators
{
/// <summary>
/// An authenicator that identifies the user by their device.
/// An authenticator that identifies the user by their device.
/// <para>A GUID is used as a fallback when the platform doesn't support SystemInfo.deviceUniqueIdentifier.</para>
/// <para>Note: deviceUniqueIdentifier can be spoofed, so security is not guaranteed.</para>
/// <para>See https://docs.unity3d.com/ScriptReference/SystemInfo-deviceUniqueIdentifier.html for details.</para>
Expand Down Expand Up @@ -47,7 +47,7 @@ public override void OnStopServer()
}

/// <summary>
/// Called on server from OnServerAuthenticateInternal when a client needs to authenticate
/// Called on server from OnServerConnectInternal when a client needs to authenticate
/// </summary>
/// <param name="conn">Connection to client.</param>
public override void OnServerAuthenticate(NetworkConnectionToClient conn)
Expand Down Expand Up @@ -94,7 +94,7 @@ public override void OnStopClient()
}

/// <summary>
/// Called on client from OnClientAuthenticateInternal when a client needs to authenticate
/// Called on client from OnClientConnectInternal when a client needs to authenticate
/// </summary>
public override void OnClientAuthenticate()
{
Expand All @@ -111,7 +111,7 @@ public override void OnClientAuthenticate()
}

// send the deviceUniqueIdentifier to the server
NetworkClient.connection.Send(new AuthRequestMessage { clientDeviceID = deviceUniqueIdentifier } );
NetworkClient.Send(new AuthRequestMessage { clientDeviceID = deviceUniqueIdentifier } );
}

/// <summary>
Expand Down
7 changes: 7 additions & 0 deletions Assets/Mirror/Authenticators/DeviceAuthenticator.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions Assets/Mirror/Authenticators/Mirror.Authenticators.asmdef
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"name": "Mirror.Authenticators",
"rootNamespace": "",
"references": [
"Mirror"
"GUID:30817c1a0e6d646d99c048fc403f5979"
],
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Assets/Mirror/Authenticators/TimeoutAuthenticator.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 17 additions & 30 deletions Assets/Mirror/CompilerSymbols/PreprocessorDefine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,34 @@ static class PreprocessorDefine
[InitializeOnLoadMethod]
public static void AddDefineSymbols()
{
#if UNITY_2021_2_OR_NEWER
string currentDefines = PlayerSettings.GetScriptingDefineSymbols(UnityEditor.Build.NamedBuildTarget.FromBuildTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup));
#else
// Deprecated in Unity 2023.1
string currentDefines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
#endif
// Remove oldest when adding next month's symbol.
// Keep a rolling 12 months of symbols.
HashSet<string> defines = new HashSet<string>(currentDefines.Split(';'))
{
"MIRROR",
"MIRROR_17_0_OR_NEWER",
"MIRROR_18_0_OR_NEWER",
"MIRROR_24_0_OR_NEWER",
"MIRROR_26_0_OR_NEWER",
"MIRROR_27_0_OR_NEWER",
"MIRROR_28_0_OR_NEWER",
"MIRROR_29_0_OR_NEWER",
"MIRROR_30_0_OR_NEWER",
"MIRROR_30_5_2_OR_NEWER",
"MIRROR_32_1_2_OR_NEWER",
"MIRROR_32_1_4_OR_NEWER",
"MIRROR_35_0_OR_NEWER",
"MIRROR_35_1_OR_NEWER",
"MIRROR_37_0_OR_NEWER",
"MIRROR_38_0_OR_NEWER",
"MIRROR_39_0_OR_NEWER",
"MIRROR_40_0_OR_NEWER",
"MIRROR_41_0_OR_NEWER",
"MIRROR_42_0_OR_NEWER",
"MIRROR_43_0_OR_NEWER",
"MIRROR_44_0_OR_NEWER",
"MIRROR_46_0_OR_NEWER",
"MIRROR_47_0_OR_NEWER",
"MIRROR_53_0_OR_NEWER",
"MIRROR_55_0_OR_NEWER",
"MIRROR_57_0_OR_NEWER",
"MIRROR_58_0_OR_NEWER",
"MIRROR_65_0_OR_NEWER",
"MIRROR_66_0_OR_NEWER"
"MIRROR_89_OR_NEWER",
"MIRROR_90_OR_NEWER",
"MIRROR_93_OR_NEWER",
"MIRROR_96_OR_NEWER"
};

// only touch PlayerSettings if we actually modified it.
// only touch PlayerSettings if we actually modified it,
// otherwise it shows up as changed in git each time.
string newDefines = string.Join(";", defines);
if (newDefines != currentDefines)
{
#if UNITY_2021_2_OR_NEWER
PlayerSettings.SetScriptingDefineSymbols(UnityEditor.Build.NamedBuildTarget.FromBuildTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup), newDefines);
#else
// Deprecated in Unity 2023.1
PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, newDefines);
#endif
}
}
}
Expand Down
9 changes: 8 additions & 1 deletion Assets/Mirror/CompilerSymbols/PreprocessorDefine.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Assets/Mirror/Components/AssemblyInfo.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 1 addition & 22 deletions Assets/Mirror/Components/Discovery/NetworkDiscovery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,14 @@
namespace Mirror.Discovery
{
[Serializable]
public class ServerFoundUnityEvent : UnityEvent<ServerResponse> {};
public class ServerFoundUnityEvent<TResponseType> : UnityEvent<TResponseType> {};

[DisallowMultipleComponent]
[AddComponentMenu("Network/Network Discovery")]
public class NetworkDiscovery : NetworkDiscoveryBase<ServerRequest, ServerResponse>
{
#region Server

public long ServerId { get; private set; }

[Tooltip("Transport to be advertised during discovery")]
public Transport transport;

[Tooltip("Invoked when a server is found")]
public ServerFoundUnityEvent OnServerFound;

public override void Start()
{
ServerId = RandomLong();

// active transport gets initialized in awake
// so make sure we set it here in Start() (after awakes)
// Or just let the user assign it in the inspector
if (transport == null)
transport = Transport.activeTransport;

base.Start();
}

/// <summary>
/// Process the request from a client
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions Assets/Mirror/Components/Discovery/NetworkDiscovery.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading