コード例 #1
0
        bool OnEncryptMessage(byte[] buf, int size, IPEndPoint remoteEP, ref int connectionId, ref ArraySegment <byte> ret)
        {
            int offset = 1;

            connectionId = BinaryUtil.ReadInt(buf, ref offset);

            if (!m_PeerManager.TryGetValue(connectionId, out PeerEntry peer))
            {
                return(false);
            }

            if (!EncryptMessage.TryUnpack(buf, size, peer.Encryptor, out var packet))
            {
                return(false);
            }

            peer.Update(remoteEP, packet.SendSequence, packet.ReceiveSequence);

            ret = packet.Payload;

            return(true);
        }