Exemple #1
0
        public bool TryAddMessagePart(MessagePart messagePart, int mtuSize)
        {
            byte[] bytes = messagePart.Encode();
            if (_currentSize + bytes.Length > (mtuSize - RaknetHandler.UdpHeaderSize))
            {
                return(false);
            }

            if (messagePart.ReliabilityHeader.PartCount > 0 && messagePart.ReliabilityHeader.PartIndex > 0)
            {
                Header.IsContinuousSend = true;
            }

            //TODO: Get rid of this stuff.
            if (FirstMessageId == 0)
            {
                FirstMessageId = messagePart.ContainedMessageId;
            }

            MessageParts.Add(messagePart);

            _currentSize += bytes.Length;

            return(true);
        }