Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix is_limited #169

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/udx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,6 @@ process_packet (udx_socket_t *socket, char *buf, ssize_t buf_len, struct sockadd
buf_len -= UDX_HEADER_SIZE;

size_t header_len = (data_offset > 0 && data_offset < buf_len) ? data_offset : buf_len;
bool is_limited = stream->writes_queued_bytes < UDX_HIGH_WATERMARK;

bool sacked = (type & UDX_HEADER_SACK) ? process_sacks(stream, buf, header_len) > 0 : false;

Expand Down Expand Up @@ -1292,13 +1291,7 @@ process_packet (udx_socket_t *socket, char *buf, ssize_t buf_len, struct sockadd
}

int32_t len = seq_diff(ack, stream->remote_acked);

if (len > 0) {
ack_update(stream, len, is_limited);
rack_detect_loss(stream);
} else if (sacked) {
rack_detect_loss(stream);
}
bool is_limited = stream->recovery;

for (int32_t j = 0; j < len; j++) {
if (stream->recovery > 0 && --(stream->recovery) == 0) {
Expand All @@ -1320,6 +1313,16 @@ process_packet (udx_socket_t *socket, char *buf, ssize_t buf_len, struct sockadd
return 1;
}

// we are user limited if queued bytes (that includes current inflight + a max packet) is less than the window
if (!is_limited) is_limited = stream->writes_queued_bytes + max_payload(stream) < cwnd_in_bytes(stream);

if (len > 0) {
ack_update(stream, len, is_limited);
rack_detect_loss(stream);
} else if (sacked) {
rack_detect_loss(stream);
}

// if data pkt, send an ack - use deferred acks as well...
if (type & UDX_HEADER_DATA_OR_END) {
// This needs some work, ie, read some modern specs...
Expand Down