Exemple #1
0
 private void GetNewDatagram()
 {
     currentDatagram             = datagramPool.Borrow();
     currentDatagram.SendOptions = channelType;
     seqCount++;
     currentDatagram.Sequence         = seqCount;
     currentDatagramTotalBufferOffset = currentDatagram.Offset;
 }
Exemple #2
0
        internal bool TryFlushSendQueues()
        {
            bool success = true;

            success = TryFlushSendChannel(noneSendChannel);
            if (success)
            {
                success = TryFlushSendChannel(inOrderSendChannel);
            }
            if (success)
            {
                success = TryFlushSendChannel(reliableSendChannel);
            }
            if (success)
            {
                success = TryFlushSendChannel(reliableInOrderSendChannel);
            }

            // send any outstanding ACKs
            if (enqueudAcks.Count > 0)
            {
                while (enqueudAcks.Count > 0)
                {
                    Datagram datagram = sendDatagramsPool.Borrow();
                    datagram.SendOptions = SendOptions.None;
                    WriteEnquedAcksToDatagram(datagram, datagram.Offset);
                    success = TrySendDatagram(datagram);
                    if (!success)
                    {
                        break;
                    }
                }
            }

            ellapsedSecondsSinceSendQueuesLastFlushed = 0.0f;

            return(success);
        }