Skip to content

Commit

Permalink
only timeout streams after 6 full RTOs, instead of any 6 transmits. p…
Browse files Browse the repository at this point in the history
…revents streams from timing out quickly due to congestion (#212)
  • Loading branch information
jthomas43 authored Oct 5, 2024
1 parent ad5a271 commit 5bbe628
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/udx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions src/udx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 5bbe628

Please sign in to comment.