From b3517b40a589fb3deb8ed641368957ce6af814b4 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Fri, 10 May 2024 09:08:13 +0200 Subject: [PATCH] do not close the stream if a state write is pending and no err (#182) --- src/udx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/udx.c b/src/udx.c index 01b13840..b0baef85 100644 --- a/src/udx.c +++ b/src/udx.c @@ -860,6 +860,8 @@ close_maybe (udx_stream_t *stream, int err) { if ((stream->status & UDX_STREAM_ALL_ENDED) != UDX_STREAM_ALL_ENDED && !(stream->status & UDX_STREAM_ALL_DESTROYED)) return 0; // if we already destroyed, bail. if (stream->status & UDX_STREAM_CLOSED) return 0; + // do not close if no error and we have a STATE queued + if (err == 0 && stream->write_wanted & UDX_STREAM_WRITE_WANT_STATE) return 0; stream->status |= UDX_STREAM_CLOSED; stream->status &= ~UDX_STREAM_CONNECTED;