From 5bbe6285c72ce7869de8fd7e96068973e5997c23 Mon Sep 17 00:00:00 2001 From: jthomas43 <129407891+jthomas43@users.noreply.github.com> Date: Sat, 5 Oct 2024 03:21:37 -0400 Subject: [PATCH] only timeout streams after 6 full RTOs, instead of any 6 transmits. prevents streams from timing out quickly due to congestion (#212) --- include/udx.h | 1 + src/udx.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/udx.h b/include/udx.h index 0660a58..1e2b735 100644 --- a/include/udx.h +++ b/include/udx.h @@ -296,6 +296,7 @@ struct udx_packet_s { bool retransmitted; bool is_tlp; uint8_t transmits; + uint8_t rto_timeouts; bool is_mtu_probe; uint16_t size; uint64_t time_sent; diff --git a/src/udx.c b/src/udx.c index 89e1aa8..4ee82e4 100644 --- a/src/udx.c +++ b/src/udx.c @@ -33,7 +33,7 @@ #define UDX_DEFAULT_TTL 64 #define UDX_DEFAULT_BUFFER_SIZE 212992 -#define UDX_MAX_TRANSMITS 6 +#define UDX_MAX_RTO_TIMEOUTS 6 #define UDX_CONG_C 400 // C=0.4 (inverse) in scaled 1000 #define UDX_CONG_C_SCALE 1e12 // ms/s ** 3 * c-scale @@ -502,6 +502,7 @@ init_stream_packet (udx_packet_t *pkt, int type, udx_stream_t *stream, const uv_ pkt->seq = stream->seq; pkt->retransmitted = false; pkt->transmits = 0; + pkt->rto_timeouts = 0; pkt->size = UDX_HEADER_SIZE; pkt->dest = stream->remote_addr; @@ -865,12 +866,13 @@ udx_rto_timeout (uv_timer_t *timer) { int64_t remaining = pkt->time_sent + stream->rack_rtt + rack_reo_wnd - now; if (pkt->seq == stream->remote_acked || remaining < 0) { - if (pkt->transmits >= UDX_MAX_TRANSMITS) { + if (pkt->rto_timeouts >= UDX_MAX_RTO_TIMEOUTS) { close_stream(stream, UV_ETIMEDOUT); break; } pkt->lost = true; + pkt->rto_timeouts++; udx__queue_unlink(&stream->inflight_queue, &pkt->queue); udx__queue_tail(&stream->retransmit_queue, &pkt->queue); @@ -2068,6 +2070,7 @@ udx_socket_send_ttl (udx_socket_send_t *req, udx_socket_t *socket, const uv_buf_ pkt->lost = false; pkt->retransmitted = false; pkt->transmits = 0; + pkt->rto_timeouts = 0; pkt->nbufs = 1; pkt->size = bufs[0].len;