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

clean up log on stream close #209

Merged
merged 1 commit into from
Sep 27, 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
5 changes: 3 additions & 2 deletions src/udx.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ on_bytes_acked (udx_stream_write_buf_t *wbuf, size_t bytes, bool cancelled) {

static void
clear_outgoing_packets (udx_stream_t *stream) {
debug_printf("clear outgoing packets\n");
debug_printf("close: clearing outgoing packets\n");

// todo: skip the math, and just
// 1. destroy all packets
Expand Down Expand Up @@ -450,10 +450,11 @@ clear_outgoing_packets (udx_stream_t *stream) {
free(pkt);
}

debug_printf("close: cancelling queued writes, queue.len=%u\n", stream->write_queue.len);

while (stream->write_queue.len > 0) {
udx_stream_write_buf_t *wbuf = udx__queue_data(udx__queue_shift(&stream->write_queue), udx_stream_write_buf_t, queue);
assert(wbuf != NULL);
debug_printf("cancel wbuf: %lu/%lu\n", wbuf->bytes_acked, wbuf->buf.len);

on_bytes_acked(wbuf, wbuf->buf.len - wbuf->bytes_acked, true);
// todo: move into on_bytes_acked itself
Expand Down
Loading