Closed carver closed 1 year ago
A more complete solution would probably be to move the ack handling into on_packet()
. For example, the ack_num
on a reverse-direction DATA packet is also currently ignored in the code. Putting it all in one place would reduce the code duplication, as well as slim down the number of function arguments to on_state()
and on_fin()
.
I'll rebase this on #109 when that's merged
Fix #103
Acknowledge sent packets using
ack_num
in FIN and DATA packetsMore specifically:
The ack_nr on the received packet was previously ignored. In some scenarios, like with dropped packets or different utp implementations, that would cause the sender to wait indefinitely for the recipient to ACK state. But the recipient had already acked with the FIN (been ignored), and disconnected. Then the sender was waiting the full connection timeout to realize it.
Even worse, if more than just the final outbound FIN was acknowledged in the inbound FIN, the sender was considering the data transfer incomplete. This was causing errors in #81 .
With this commit:
I tested this on a #81 locally, and (only) with this patch, I was able to get 10 successful test runs in a row, even when doubling the concurrency to 2000 connections.