Closed
Description
I did this
i make http/3 requests on easy handle, then add to multi handle. pesudo code like this
- init multi handle
-
- init easy handle1, then add to multi
- multi poll(such as 100ms)
-
- init easy handle2, then add to multi, handle2 will resue quic connection
- multi poll(for such as 100ms)
- remove easy handle1
- multi poll(for such as 10s)
- ...
I expected the following
after remove easy handle1, the http/3 stream is closed but quic stream is still opened. why?
actually, quic stream0 is still transer data. i find this from the source code at curl_ngtcp2.c
Q why quic stream is remain opened when we shutdown http/3 stream
static void h3_data_done(struct Curl_cfilter *cf, struct Curl_easy *data)
{
struct cf_ngtcp2_ctx *ctx = cf->ctx;
struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
(void)cf;
if(stream) {
CURL_TRC_CF(data, cf, "[%"PRId64"] easy handle is done", stream->id);
if(ctx->h3conn && !stream->closed) {
/* shutdown http/3 stream, but quic stream is open, why not */
nghttp3_conn_shutdown_stream_read(ctx->h3conn, stream->id);
nghttp3_conn_close_stream(ctx->h3conn, stream->id,
NGHTTP3_H3_REQUEST_CANCELLED);
nghttp3_conn_set_stream_user_data(ctx->h3conn, stream->id, NULL);
ngtcp2_conn_set_stream_user_data(ctx->qconn, stream->id, NULL);
stream->closed = TRUE;
}
Curl_bufq_free(&stream->sendbuf);
Curl_h1_req_parse_free(&stream->h1);
free(stream);
H3_STREAM_LCTX(data) = NULL;
}
}
...
static CURLcode cf_ngtcp2_data_event(struct Curl_cfilter *cf,
struct Curl_easy *data,
int event, int arg1, void *arg2)
case CF_CTRL_DATA_DETACH:
h3_data_done(cf, data);
break;
curl/libcurl version
curl version: libcurl/8.7.0-DEV quictls/1.1.1s zlib/1.2.11 ngtcp2/1.4.0 nghttp3/1.2.0
operating system
Darwin B-92RGMD6R-1918.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:22 PDT 2023; root:xnu-8796.121.3~7/RELEASE_X86_64 x86_64