usbmuxd
usbmuxd copied to clipboard
ACK packets sometimes sent twice
While testing, I've noticed that sometimes ACK packets were sent twice in a row. After going through the code, I think I've found the reason: In device_tcp_input, when data is received from the device on a TCP connection, an ACK is sent (a call to send_tcp_ack was added in a recent commit). But, since the connection's tx_ack is only increased in device_client_process (after the data is actually sent to the client), the ACK doesn't ACK the data received. So in my case, another ACK was sent in the next iteration because of a timeout (after the data was sent to the client). I think it would be better to send the ACK after increasing tx_ack, either in device_tcp_input or in device_client_process. What do you think?
Thanks, confirming this is a bug. I think it would be good to not sent duplicate or obsolete ACKs at all and fix up the I/O to properly ACK packets.