refactor: remove pointless if

This commit is contained in:
Paul Pacheco 2019-04-06 06:51:37 -05:00
parent b202473bcf
commit e8679a0562

View File

@ -242,20 +242,18 @@ public virtual void TransportReceive(byte[] buffer)
{ {
// unpack message // unpack message
NetworkReader reader = new NetworkReader(buffer); NetworkReader reader = new NetworkReader(buffer);
if (MessagePacker.UnpackMessage(reader, out int msgType)) MessagePacker.UnpackMessage(reader, out int msgType);
{
if (logNetworkMessages)
{
Debug.Log("ConnectionRecv con:" + connectionId + " msgType:" + msgType + " content:" + BitConverter.ToString(buffer));
}
// try to invoke the handler for that message if (logNetworkMessages)
if (InvokeHandler(msgType, reader)) {
{ Debug.Log("ConnectionRecv con:" + connectionId + " msgType:" + msgType + " content:" + BitConverter.ToString(buffer));
lastMessageTime = Time.time; }
}
// try to invoke the handler for that message
if (InvokeHandler(msgType, reader))
{
lastMessageTime = Time.time;
} }
else Debug.LogError("HandleBytes UnpackMessage failed for: " + BitConverter.ToString(buffer));
} }
catch (Exception exception) catch (Exception exception)
{ {