m_internalmsgs renamed to packetqueue

This commit is contained in:
vis2k 2019-02-26 09:44:40 +01:00
parent 93e7da9b88
commit d86d9e3e87

View File

@ -8,9 +8,8 @@ sealed class LocalClient : NetworkClient
{
// local client in host mode might call Cmds/Rpcs during Update, but we
// want to apply them in LateUpdate like all other Transport messages
// to avoid race conditions.
// -> that's why there is an internal message queue.
Queue<NetworkMessage> m_InternalMsgs = new Queue<NetworkMessage>();
// to avoid race conditions. keep packets in Queue until LateUpdate.
Queue<NetworkMessage> packetQueue = new Queue<NetworkMessage>();
bool m_Connected;
public override void Disconnect()
@ -45,9 +44,9 @@ internal void InternalConnectLocalServer(bool generateConnectMsg)
internal override void Update()
{
// process internal messages so they are applied at the correct time
while (m_InternalMsgs.Count > 0)
while (packetQueue.Count > 0)
{
NetworkMessage internalMessage = m_InternalMsgs.Dequeue();
NetworkMessage internalMessage = packetQueue.Dequeue();
connection.InvokeHandler(internalMessage);
connection.lastMessageTime = Time.time;
}
@ -77,7 +76,7 @@ void PostInternalMessage(short msgType, NetworkReader contentReader)
reader = contentReader,
conn = connection
};
m_InternalMsgs.Enqueue(msg);
packetQueue.Enqueue(msg);
}
void PostInternalMessage(short msgType)