Skip to content

Commit 14cd37b

Browse files
Fix deleteting previosly closed streams.
Previously we delete previously closed streams in case when count of closed streams is greater then TFW_MAX_CLOSED_STREAMS. But there is a case when count of streams is equal to max concurrent streams when we should close all closed streams to be able to create new streams.
1 parent 36db27b commit 14cd37b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fw/http2.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Tempesta FW
33
*
4-
* Copyright (C) 2024 Tempesta Technologies, Inc.
4+
* Copyright (C) 2024-2025 Tempesta Technologies, Inc.
55
*
66
* This program is free software; you can redistribute it and/or modify it
77
* under the terms of the GNU General Public License as published by
@@ -360,6 +360,7 @@ void
360360
tfw_h2_closed_streams_shrink(TfwH2Ctx *ctx)
361361
{
362362
TfwStream *cur;
363+
unsigned int max_streams = ctx->lsettings.max_streams;
363364
TfwStreamQueue *closed_streams = &ctx->closed_streams;
364365

365366
T_DBG3("%s: ctx [%p] closed streams num %lu\n", __func__, ctx,
@@ -368,7 +369,9 @@ tfw_h2_closed_streams_shrink(TfwH2Ctx *ctx)
368369
while (1) {
369370
spin_lock(&ctx->lock);
370371

371-
if (closed_streams->num <= TFW_MAX_CLOSED_STREAMS) {
372+
if (closed_streams->num <= TFW_MAX_CLOSED_STREAMS
373+
&& (ctx->streams_num < max_streams
374+
|| !closed_streams->num)) {
372375
spin_unlock(&ctx->lock);
373376
break;
374377
}

0 commit comments

Comments
 (0)