private void EnqueueCurrentDatagram() { // Enqueue current datagram setting relevant fields. currentDatagram.Resize(currentDatagramTotalBufferOffset - currentDatagram.Offset); queue.Enqueue(currentDatagram); // get a new one GetNewDatagram(); }
// writes as many enqued as as can fit into datagram private void WriteEnquedAcksToDatagram(Datagram datagram, int index) { while (enqueudAcks.Count > 0 && (datagram.MaxSize - (index - datagram.Offset)) > Const.FALCON_PACKET_HEADER_SIZE) { AckDetail ack = enqueudAcks.Dequeue(); FalconHelper.WriteAck(ack, datagram.BackingBuffer, index); index += Const.FALCON_PACKET_HEADER_SIZE; } datagram.Resize(index - datagram.Offset); }