Skip to content

Commit

Permalink
ngtcp2: disconnect the QUIC connection proper
Browse files Browse the repository at this point in the history
Reported-by: mehatzri on github
Reviewed-by: Tatsuhiro Tsujikawa
Fixes curl#8534
closes curl#8569
  • Loading branch information
bagder committed Mar 10, 2022
1 parent 2583c3d commit 96edc79
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/vquic/ngtcp2.c
Expand Up @@ -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);
Expand Down

0 comments on commit 96edc79

Please sign in to comment.