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