Quantcast
Channel: Questions in topic: "channels"
Viewing all articles
Browse latest Browse all 45

In HLAPI are the ChannelPacket in a reliable ChannelBuffer supposed to be delivered in sequence?

$
0
0
This question might be a bit on the technical side. I have been looking around the source code of the Unity networking HLAPI and I noticed something that confuses me. If a [ChannelBuffer][1] is considered reliable, it uses a Queue to store pending ChannelPackets. These packets are then sent in FIFO order to the NetworkTransport whenever SendInternalBuffer() is called - typically at the end of each frame. That's unless there's room for them to be sent immediately. I was under the assumption that the use of a Queue structure, was in order to have the packets sent in the sequence they're passed to the ChannelBuffer, but then I noticed the following piece of code in the SendInternalBuffer() method: var packet = m_PendingPackets.Dequeue(); if (!packet.SendToTransport(m_Connection, m_ChannelId)) { m_PendingPackets.Enqueue(packet); break; } This code is part of the loop that sends the pending packets to the NetworkTransport. It removes a packet from the beginning of the queue and attempts to send it, if it fails, it add's the packet at the end of the queue. Unless the queue is empty, this enqueue action, messes with the order of the packets, thus breaking my assumption (and breaking the point of having a queue in the first place, I guess). **So my question:** Are messages/packets, sent using a reliable Channel, supposed to be sent in sequence? If this is the case, calling enqueue in the above snippet is a bug. NOTE: I'm not considering whether the channel is ReliableSequenced or just Reliable, since the ChannelBuffer doesn't have a notion of the specific QOS. It only cares about whether it's reliable or not. [1]: https://bitbucket.org/Unity-Technologies/networking/src/bfdfc58bb61bfdd7d49ceb8c69583482febadc84/Runtime/ChannelBuffer.cs?at=5.6&fileviewer=file-view-default

Viewing all articles
Browse latest Browse all 45

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>