From b9d95a16fbc99bf095987d12305bf4a57d5c6032 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Tue, 7 Dec 2021 19:51:11 -0800 Subject: [PATCH] QNetworkServer.RegisterHandlerSafe --- QSB/Utility/VariableSync/BaseVariableSyncer.cs | 2 +- QuantumUNET/QNetworkServer.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/QSB/Utility/VariableSync/BaseVariableSyncer.cs b/QSB/Utility/VariableSync/BaseVariableSyncer.cs index 934cdff1..1a2df65a 100644 --- a/QSB/Utility/VariableSync/BaseVariableSyncer.cs +++ b/QSB/Utility/VariableSync/BaseVariableSyncer.cs @@ -20,7 +20,7 @@ namespace QSB.Utility.VariableSync public virtual void Awake() { - QNetworkServer.instance.m_SimpleServerSimple.RegisterHandlerSafe(short.MaxValue, HandleVariable); + QNetworkServer.RegisterHandlerSafe(short.MaxValue, HandleVariable); if (LocalPlayerAuthority) { diff --git a/QuantumUNET/QNetworkServer.cs b/QuantumUNET/QNetworkServer.cs index 13551272..eee1fc59 100644 --- a/QuantumUNET/QNetworkServer.cs +++ b/QuantumUNET/QNetworkServer.cs @@ -615,6 +615,8 @@ namespace QuantumUNET public static void RegisterHandler(short msgType, QNetworkMessageDelegate handler) => instance.m_SimpleServerSimple.RegisterHandler(msgType, handler); + public static void RegisterHandlerSafe(short msgType, QNetworkMessageDelegate handler) => instance.m_SimpleServerSimple.RegisterHandlerSafe(msgType, handler); + public static void UnregisterHandler(short msgType) => instance.m_SimpleServerSimple.UnregisterHandler(msgType); public static void ClearHandlers() => instance.m_SimpleServerSimple.ClearHandlers(); @@ -1348,7 +1350,7 @@ namespace QuantumUNET private readonly HashSet m_ExternalConnections; - public readonly ServerSimpleWrapper m_SimpleServerSimple; + private readonly ServerSimpleWrapper m_SimpleServerSimple; private float m_MaxDelay = 0.1f;