not needed anymore

This commit is contained in:
vis2k 2021-05-15 11:08:31 +08:00
parent 3255106b76
commit 1bb137d7ef

View File

@ -1429,9 +1429,6 @@ static NetworkWriter GetEntitySerializationForConnection(NetworkIdentity identit
}
}
// avoid allocations in NetworkLateUpdate
static Queue<NetworkConnection> connectionsToDisconnect = new Queue<NetworkConnection>();
// NetworkLateUpdate called after any Update/FixedUpdate/LateUpdate
// (we add this to the UnityEngine in NetworkLoop)
internal static void NetworkLateUpdate()
@ -1439,9 +1436,6 @@ internal static void NetworkLateUpdate()
// only process spawned & connections if active
if (active)
{
// clear cached list
connectionsToDisconnect.Clear();
// world state can be huge, even bigger than transport max size.
// we only send what fits.
int transportMaxSize = Transport.activeTransport.GetMaxPacketSize(Channels.Reliable);
@ -1529,17 +1523,11 @@ internal static void NetworkLateUpdate()
connection.Send(world);
//Debug.Log($"Sending {world.TotalSize()} bytes World to connId={connection.connectionId}");
}
else
{
// show a useful(!) message
Debug.LogError($"Disconnecting connectionId={connection.connectionId} because the World around it with {world.TotalSize()} bytes doesn't fit into Transport {transportMaxSize} max message size. This should never happen.");
// disconnect that connection for now,
// since we don't have a way to deal with it yet.
// -> need to do it after the loop to not break it
//connection.Disconnect();
connectionsToDisconnect.Enqueue(connection);
}
// note: don't need to disconnect because this is
// not supposed to happen unless our above
// 'does it fit' calculation is wrong
else Debug.LogError($"The World around connectionId={connection.connectionId} with {world.TotalSize()} bytes doesn't fit into Transport {transportMaxSize} max message size. This should never happen.");
}
}
@ -1547,14 +1535,6 @@ internal static void NetworkLateUpdate()
connection.Update();
}
// disconnect the connections we wanted to disconnect now that
// we are not in the for loop anymore.
while (connectionsToDisconnect.Count > 0)
{
NetworkConnection connection = connectionsToDisconnect.Dequeue();
connection.Disconnect();
}
// return serialized writers to pool, clear set
// TODO this is for feature parity before push->pull change.
// make this more simple / unnecessary later.