Commit a3e9350
fix: Sends failing on UTP adapter when queue is full (#1333)
* 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
Co-authored-by: Andrew Spiering <andrews@unity3d.com>1 parent 1dc2e5a commit a3e9350
File tree
3 files changed
+67
-18
lines changed- com.unity.netcode.adapter.utp
- Runtime
- Tests/Runtime
3 files changed
+67
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
578 | 578 | | |
579 | 579 | | |
580 | 580 | | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
585 | 588 | | |
586 | 589 | | |
587 | 590 | | |
| |||
611 | 614 | | |
612 | 615 | | |
613 | 616 | | |
614 | | - | |
| 617 | + | |
615 | 618 | | |
616 | | - | |
617 | | - | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
618 | 627 | | |
619 | 628 | | |
620 | | - | |
| 629 | + | |
621 | 630 | | |
622 | 631 | | |
623 | 632 | | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | 633 | | |
633 | 634 | | |
634 | 635 | | |
| |||
Lines changed: 49 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
81 | 79 | | |
82 | 80 | | |
83 | 81 | | |
| |||
113 | 111 | | |
114 | 112 | | |
115 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
116 | 163 | | |
117 | 164 | | |
118 | 165 | | |
| |||
0 commit comments