mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
perf: NetworkServer.Update: separate connections update loop moved into the main loop. now there is only one connections loop anymore.
This commit is contained in:
parent
5775a36e49
commit
aa357dc58b
@ -479,8 +479,7 @@ internal static void NetworkLateUpdate()
|
||||
// only process spawned & connections if active
|
||||
if (active)
|
||||
{
|
||||
// for each READY connection:
|
||||
// pull in UpdateVarsMessage for each entity it observes
|
||||
// go through all connections
|
||||
foreach (NetworkConnectionToClient connection in connections.Values)
|
||||
{
|
||||
// check for inactivity
|
||||
@ -493,6 +492,8 @@ internal static void NetworkLateUpdate()
|
||||
}
|
||||
|
||||
// has this connection joined the world yet?
|
||||
// for each READY connection:
|
||||
// pull in UpdateVarsMessage for each entity it observes
|
||||
if (connection.isReady)
|
||||
{
|
||||
// for each entity that this connection is seeing
|
||||
@ -584,6 +585,9 @@ internal static void NetworkLateUpdate()
|
||||
else Debug.LogWarning("Found 'null' entry in observing list for connectionId=" + connection.connectionId + ". Please call NetworkServer.Destroy to destroy networked objects. Don't use GameObject.Destroy.");
|
||||
}
|
||||
}
|
||||
|
||||
// update connection to flush out batched messages
|
||||
connection.Update();
|
||||
}
|
||||
|
||||
// return serialized writers to pool, clear set
|
||||
@ -613,13 +617,6 @@ internal static void NetworkLateUpdate()
|
||||
identity.ClearAllComponentsDirtyBits();
|
||||
}
|
||||
}
|
||||
|
||||
// update all connections to send out batched messages in interval
|
||||
// TODO move this into the above foreach
|
||||
foreach (NetworkConnectionToClient conn in connections.Values)
|
||||
{
|
||||
conn.Update();
|
||||
}
|
||||
}
|
||||
|
||||
// process all incoming messages after updating the world
|
||||
|
Loading…
Reference in New Issue
Block a user