You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Sends failing on UTP adapter when queue is full (#1317)
* fix: Sends failing on UTP adapter when queue is full
Or close to full. There were two issues here.
First, the payload capacity of the fragmentation pipeline didn't account
for the entire size of the packet. Unfortunately, payload capacity in
the context of the fragmentation pipeline is a bit of a misnomer since
it also includes headers and other such overhead. We were setting it to
the size of a full send queue, and so when you added UTP headers, we
ended up with a packet too large for the pipeline. Bumping up the value
a bit solves this issue.
Second, when sending a single message that was within 4 bytes of the
send queue capacity, we'd silently fail to send it. The reason was we
didn't account for the extra overhead taken by the data length in the
send queue (which requires 4 bytes). Thus the send code would think the
message could fit in the queue when it couldn't. Fixing this simply
required accounting for the 4 extra bytes in the send logic.
Two tests were also added to test sends when the send queue is full
(either from one big send or from multiple smaller ones in a row). Both
tests fail without the fixes in the adapter.
* Cleaner fix for the send queue being full scenario
This one depends on a fix in UTP that's still being reviewed, though.
* Fix possible re-ordering issue for large messages
* Reword the warning when sending immediately
Events can't be larger than m_SendQueueBatchSize. UTP will drop them and
log an error in the current configuration. Reword the warning so that we
don't imply that it's been sent, only that we're trying to send it. If
it fails, there will be an error in the log following it, making it
clear to the user what happened.
* Update UTP dependency to 1.0.0-pre.7
* fix: Fixing validation error
Co-authored-by: Andrew Spiering <andrews@unity3d.com>
// Try add the message to the queue as there might be enough room now that it's empty.
610
+
success=queue.AddEvent(payload);
611
+
if(!success)// Message is too large to fit in the queue. Shouldn't happen under normal operation.
603
612
{
604
613
// If data is too large to be batched, flush it out immediately. This happens with large initial spawn packets from Netcode for Gameobjects.
605
-
Debug.LogWarning($"Sent {payload.Count}bytes based on delivery method: {networkDelivery}. Event size exceeds sendQueueBatchSize: ({m_SendQueueBatchSize}). This can be the initial payload!");
614
+
Debug.LogWarning($"Event of size {payload.Count}too large to fit in send queue (of size {m_SendQueueBatchSize}). Trying to send directly. This could be the initial payload!");
606
615
Debug.Assert(networkDelivery==NetworkDelivery.ReliableFragmentedSequenced);// Messages like this, should always be sent via the fragmented pipeline.
0 commit comments