internal void EnqueueOutgoingCommand(OutgoingCommand command)
        {
            UdpChannel udpChannel = _channels[command.Channel];

            lock (udpChannel)
            {
                SendQueueBase queue = command.IsReliable ? (SendQueueBase)udpChannel.ReliableSendQueue : udpChannel.UnreliableSendQueue;
                queue.EnqueueOutgoingCommand(command);
            }
        }
        private int SerializeQueue(SendQueueBase sendQueue, uint currentSendingTime)
        {
            var commands        = sendQueue.DequeueSendableCommands(_udpBufferIndex, _udpBuffer.Length);
            var udpCommandCount = commands.Count;

            for (int i = 0; i < commands.Count; i++)
            {
                _udpBufferIndex = commands[i].Serialize(_udpBuffer, _udpBufferIndex);
                if (commands[i].IsReliable)
                {
                    EnqueueSentCommand(commands[i], currentSendingTime);
                }
            }
            return(udpCommandCount);
        }