From 64c80a5317aa4229c4b66349279e2c542801b2ef Mon Sep 17 00:00:00 2001 From: James Thomas Date: Thu, 19 Dec 2024 18:07:47 -0500 Subject: [PATCH] early return on reentry in ack_packet --- src/udx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/udx.c b/src/udx.c index c5462de..a80f549 100644 --- a/src/udx.c +++ b/src/udx.c @@ -1070,13 +1070,17 @@ ack_packet (udx_stream_t *stream, uint32_t seq, int sack) { if (write->bytes_acked == write->size && write->on_ack) { write->on_ack(write, 0, sack); + + // reentry from write->on_ack + if (stream->status & UDX_STREAM_DEAD) { + free(pkt); + return 2; + } } } free(pkt); - if (stream->status & UDX_STREAM_DEAD) return 2; // reentry from write->on_ack - // TODO: the end condition needs work here to be more "stateless" // ie if the remote has acked all our writes, then instead of waiting for retransmits, we should // clear those and mark as local ended NOW.