From: Daniel Stenberg Date: Wed, 9 Mar 2022 13:16:47 +0000 (+0100) Subject: ngtcp2: disconnect the QUIC connection proper X-Git-Tag: curl-7_83_0~170 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=96edc7954f5c2ca34587c44d0f6e46faa5492717;p=thirdparty%2Fcurl.git ngtcp2: disconnect the QUIC connection proper Reported-by: mehatzri on github Reviewed-by: Tatsuhiro Tsujikawa Fixes #8534 closes #8569 --- diff --git a/lib/vquic/ngtcp2.c b/lib/vquic/ngtcp2.c index aac092b8d2..30596042bc 100644 --- a/lib/vquic/ngtcp2.c +++ b/lib/vquic/ngtcp2.c @@ -858,8 +858,23 @@ static int ng_getsock(struct Curl_easy *data, struct connectdata *conn, static void qs_disconnect(struct quicsocket *qs) { + char buffer[NGTCP2_MAX_UDP_PAYLOAD_SIZE]; + ngtcp2_tstamp ts; + ngtcp2_ssize rc; if(!qs->conn) /* already closed */ return; + ts = timestamp(); + rc = ngtcp2_conn_write_connection_close(qs->qconn, NULL, /* path */ + NULL, /* pkt_info */ + (uint8_t *)buffer, sizeof(buffer), + 0, /* error_code */ + NULL, 0, /* reason + len */ + ts); + if(rc > 0) { + while((send(qs->conn->sock[FIRSTSOCKET], buffer, rc, 0) == -1) && + SOCKERRNO == EINTR); + } + qs->conn = NULL; if(qs->qlogfd != -1) { close(qs->qlogfd);