Esempio n. 1
0
        bool OnPlainMessage(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 (!peer.EndPoint.Equals(remoteEP))
            {
                return(false);
            }

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

            ret = packet.Payload;

            return(true);
        }