Пример #1
0
    void RawNetRecv(ActorReplicationChannel channel, int size)
    {
#if PROFILING
        try {
            Perf.Begin("World.RawNetRecv");
#endif
        _netArchive.BeginRead(size);
        int typeID = _netArchive.ReadInt();
        NetMsg msg = _netMsgFactory.GetNetMsg(typeID);
        if (msg != null)
        {
            msg.Serialize(channel.connection, _netArchive);
            if (_netArchive.hasUnreadBytes)
            {
                throw new System.IO.IOException(msg.GetType().FullName + " did not consume its entire payload.");
            }
            DynamicDispatchNetMsg(msg, channel);
        }
        else
        {
            throw new System.IO.IOException("Unrecognized net message type " + typeID);
        }
#if PROFILING
    }

    finally {
        Perf.End();
    }
#endif
    }