From 50c35e5b80a146612374d1149569967cf2ad596d Mon Sep 17 00:00:00 2001 From: Dmitri Tikhonov Date: Mon, 25 Jan 2021 10:44:33 -0500 Subject: [PATCH] Fix gQUIC connection close: there is no HEADERS stream without HTTP flag This is a bit of an unexpected use case, as gQUIC usually means that there is HEADERS stream, but the API allows one to turn HTTP off. Fixes bug #220. --- src/liblsquic/lsquic_full_conn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/liblsquic/lsquic_full_conn.c b/src/liblsquic/lsquic_full_conn.c index b50d647..1a5d913 100644 --- a/src/liblsquic/lsquic_full_conn.c +++ b/src/liblsquic/lsquic_full_conn.c @@ -2615,10 +2615,12 @@ maybe_close_conn (struct full_conn *conn) struct lsquic_stream *stream; struct lsquic_hash_elem *el; #endif + const unsigned n_special_stream = N_SPECIAL_STREAMS + - !(conn->fc_flags & FC_HTTP); if ((conn->fc_flags & (FC_CLOSING|FC_GOAWAY_SENT|FC_SERVER)) == (FC_GOAWAY_SENT|FC_SERVER) - && lsquic_hash_count(conn->fc_pub.all_streams) == N_SPECIAL_STREAMS) + && lsquic_hash_count(conn->fc_pub.all_streams) == n_special_streams) { #ifndef NDEBUG for (el = lsquic_hash_first(conn->fc_pub.all_streams); el;