Fix issue where ack is not sent when duplicate packet
arrives and delayed acks is disabled.
@@ -404,11 +404,7 @@ static inline bool csp_rdp_should_ack(csp_conn_t * conn) {
/* If delayed ACKs are not used, always ACK */
if (!conn->rdp.delayed_acks) {
- if (conn->rdp.rcv_lsa != conn->rdp.rcv_cur) {
return true;
- } else {
- return false;
- }
}
/* ACK if time since last ACK is greater than ACK timeout */
@@ -451,6 +447,7 @@ void csp_rdp_flush_all(csp_conn_t * conn) {
}
+
int csp_rdp_check_ack(csp_conn_t * conn) {
/* Check all RX queues for spare capacity */
@@ -555,7 +552,11 @@ void csp_rdp_check_timeouts(csp_conn_t * conn) {
* ACK TIMEOUT:
* Check ACK timeouts, if we have unacknowledged segments
*/
+
+ if (conn->rdp.delayed_acks) {
csp_rdp_check_ack(conn);
+ }
+
/* Wake user task if TX queue is ready for more data */
if (conn->rdp.state == RDP_OPEN)
@@ -788,6 +789,7 @@ void csp_rdp_new_packet(csp_conn_t * conn, csp_packet_t * packet) {
if (rx_header->seq_nr != (uint16_t)(conn->rdp.rcv_cur + 1)) {
if (csp_rdp_rx_queue_add(conn, packet, rx_header->seq_nr) != CSP_QUEUE_OK) {
csp_log_protocol("Duplicate sequence number");
+ csp_rdp_check_ack(conn);
goto discard_open;
}
csp_rdp_send_eack(conn);
