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

stop tlp timer on stream end #194

Merged
merged 2 commits into from
Jul 26, 2024
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
18 changes: 17 additions & 1 deletion src/udx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,14 @@ udx__unshift_packet (udx_packet_t *pkt, udx_socket_t *socket) {

if (pkt->type == UDX_PACKET_TYPE_STREAM_DESTROY) {
udx_stream_t *stream = pkt->ctx;

// the socket wasn't ready to send our packet, prepare to try again
// 1. reset the UDX_STREAM_WRITE_WANT_DESTROY flag
// 2. reset the sequence number so that we don't create a gap in the stream
if (pkt->seq + 1 == stream->seq) {
mafintosh marked this conversation as resolved.
Show resolved Hide resolved
stream->seq--;
}

stream->write_wanted |= UDX_STREAM_WRITE_WANT_DESTROY;
free(pkt);
return;
Expand Down Expand Up @@ -1129,7 +1137,10 @@ udx_tlp_timeout (uv_timer_t *timer) {
udx_stream_t *stream = timer->data;

assert(stream->status & UDX_STREAM_CONNECTED);
assert(stream->remote_acked != stream->seq);

if (stream->remote_acked == stream->seq) {
return;
}

if (stream->tlp_in_flight || !stream->tlp_permitted) {
schedule_loss_probe(stream);
Expand Down Expand Up @@ -1737,6 +1748,11 @@ process_packet (udx_socket_t *socket, char *buf, ssize_t buf_len, struct sockadd
// TODO: make this work as well, if the ack packet is lost, ie
// have some internal (capped) queue of "gracefully closed" streams (TIME_WAIT)

if (stream->remote_acked == stream->seq) {
uv_timer_stop(&stream->rto_timer);
uv_timer_stop(&stream->tlp_timer);
}

stream->write_wanted |= UDX_STREAM_WRITE_WANT_STATE;
update_poll(stream->socket);
close_maybe(stream, 0);
Expand Down
Loading