syntax: CheckForInactiveConnections moved above NetworkServer.Update

This commit is contained in:
vis2k 2021-03-04 19:30:53 +08:00
parent 6cedb5b404
commit 6b83411593

View File

@ -472,6 +472,21 @@ struct Serialization
static Dictionary<NetworkIdentity, Serialization> serializations =
new Dictionary<NetworkIdentity, Serialization>();
static void CheckForInactiveConnections()
{
if (!disconnectInactiveConnections)
return;
foreach (NetworkConnectionToClient conn in connections.Values)
{
if (!conn.IsAlive(disconnectInactiveTimeout))
{
Debug.LogWarning($"Disconnecting {conn} for inactivity!");
conn.Disconnect();
}
}
}
// NetworkLateUpdate called after any Update/FixedUpdate/LateUpdate
// (we add this to the UnityEngine in NetworkLoop)
internal static void NetworkLateUpdate()
@ -628,21 +643,6 @@ internal static void NetworkLateUpdate()
[Obsolete("NetworkServer.Update is now called internally from our custom update loop. No need to call Update manually anymore.")]
public static void Update() => NetworkLateUpdate();
static void CheckForInactiveConnections()
{
if (!disconnectInactiveConnections)
return;
foreach (NetworkConnectionToClient conn in connections.Values)
{
if (!conn.IsAlive(disconnectInactiveTimeout))
{
Debug.LogWarning($"Disconnecting {conn} for inactivity!");
conn.Disconnect();
}
}
}
static void AddTransportHandlers()
{
Transport.activeTransport.OnServerConnected = OnConnected;