NetworkClient: removed static message caching to simplify code and reduce state

This commit is contained in:
vis2k 2018-06-10 10:04:45 +02:00
parent 8957af215c
commit 8e7095262f

View File

@ -37,9 +37,6 @@ public class NetworkClient
EndPoint m_RemoteEndPoint;
// static message objects to avoid runtime-allocations
static CRCMessage s_CRCMessage = new CRCMessage();
NetworkMessageHandlers m_MessageHandlers = new NetworkMessageHandlers();
protected NetworkConnection m_Connection;
@ -891,8 +888,9 @@ internal void RegisterSystemHandlers(bool localClient)
void OnCRC(NetworkMessage netMsg)
{
netMsg.ReadMessage(s_CRCMessage);
NetworkCRC.Validate(s_CRCMessage.scripts, numChannels);
CRCMessage msg = new CRCMessage();
netMsg.ReadMessage(msg);
NetworkCRC.Validate(msg.scripts, numChannels);
}
public void RegisterHandler(short msgType, NetworkMessageDelegate handler)