Skip to content

Commit

Permalink
per stream timers for rack and RTO (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
jthomas43 authored May 27, 2024
1 parent 6a6a4df commit 6c82fb3
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 235 deletions.
22 changes: 8 additions & 14 deletions include/udx.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ extern "C" {
#define UDX_MTU_STATE_ERROR 3
#define UDX_MTU_STATE_SEARCH_COMPLETE 4

#define UDX_CLOCK_GRANULARITY_MS 20

#define UDX_MAGIC_BYTE 255
#define UDX_VERSION 1

Expand All @@ -47,10 +45,6 @@ extern "C" {
#define UDX_STREAM_DESTROYED_REMOTE 0b01000000000
#define UDX_STREAM_CLOSED 0b10000000000

#define UDX_PACKET_STATE_UNCOMMITTED 0
#define UDX_PACKET_STATE_INFLIGHT 1
#define UDX_PACKET_STATE_RETRANSMIT 2

#define UDX_PACKET_TYPE_STREAM_RELAY 0b00000
#define UDX_PACKET_TYPE_STREAM_STATE 0b00001
#define UDX_PACKET_TYPE_STREAM_WRITE 0b00010
Expand Down Expand Up @@ -124,12 +118,10 @@ typedef void (*udx_interface_event_cb)(udx_interface_event_t *handle, int status
typedef void (*udx_interface_event_close_cb)(udx_interface_event_t *handle);

struct udx_s {
uv_timer_t timer;
uv_loop_t *loop;

uint32_t refs;
uint32_t sockets;
udx_socket_t *timer_closed_by;

uint32_t streams_len;
uint32_t streams_max_len;
Expand Down Expand Up @@ -188,7 +180,6 @@ struct udx_stream_s {
size_t writes_queued_bytes;

bool reordering_seen;
int retransmitting;

udx_t *udx;
udx_socket_t *socket;
Expand Down Expand Up @@ -239,9 +230,10 @@ struct udx_stream_s {
uint32_t pkts_inflight; // packets inflight to the other peer
uint32_t pkts_buffered; // how many (data) packets received but not processed (out of order)?

// timestamps...
uint64_t rto_timeout;
uint64_t rack_timeout;
// optimize: use one timer and a action (RTO, RACK_REO, TLP) variable
int nrefs;
uv_timer_t rto_timer;
uv_timer_t rack_reo_timer;

size_t inflight;

Expand All @@ -261,16 +253,18 @@ struct udx_stream_s {
udx_fifo_t retransmit_queue; // udx_packet_t

udx_fifo_t unordered;

int rc;
};

struct udx_packet_s {
uint32_t seq; // must be the first entry, so its compat with the cirbuf

int status;
int type;
int ttl;
int is_retransmit;

bool lost;
bool retransmitted;
uint8_t transmits;
bool is_mtu_probe;
uint16_t size;
Expand Down
12 changes: 5 additions & 7 deletions src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ debug_print_cwnd_stats (udx_stream_t *stream) {
if (DEBUG) fprintf(stderr, __VA_ARGS__); \
} while (0)

/*
static void
debug_print_outgoing (udx_stream_t *stream) {
if (DEBUG) {
Expand All @@ -40,18 +41,15 @@ debug_print_outgoing (udx_stream_t *stream) {
continue;
}
if (pkt->status == UDX_PACKET_STATE_INFLIGHT) {
debug_printf("I");
continue;
}
if (pkt->status == UDX_PACKET_STATE_RETRANSMIT) {
if (pkt->lost) {
debug_printf("R");
continue;
} else {
debug_printf("I");
}
assert(false && "should only be inflight or retransmitting");
}
debug_printf("\n");
}
}
*/

#endif // UDX_DEBUG_H
Loading

0 comments on commit 6c82fb3

Please sign in to comment.