mirror of
https://github.com/curl/curl.git
synced 2025-04-24 16:40:32 +08:00
quiche: close the connection
Reported-by: Junho Choi Fixes #6213 Closes #6217
This commit is contained in:
parent
2d1df660bc
commit
26f682bcc4
@ -89,8 +89,17 @@ static int quiche_perform_getsock(const struct connectdata *conn,
|
||||
return quiche_getsock((struct connectdata *)conn, socks);
|
||||
}
|
||||
|
||||
static CURLcode qs_disconnect(struct quicsocket *qs)
|
||||
static CURLcode qs_disconnect(struct connectdata *conn,
|
||||
struct quicsocket *qs)
|
||||
{
|
||||
if(qs->conn) {
|
||||
(void)quiche_conn_close(qs->conn, TRUE, 0, NULL, 0);
|
||||
/* flushing the egress is not a failsafe way to deliver all the
|
||||
outstanding packets, but we also don't want to get stuck here... */
|
||||
(void)flush_egress(conn, qs->sockfd, qs);
|
||||
quiche_conn_free(qs->conn);
|
||||
qs->conn = NULL;
|
||||
}
|
||||
if(qs->h3config)
|
||||
quiche_h3_config_free(qs->h3config);
|
||||
if(qs->h3c)
|
||||
@ -99,10 +108,6 @@ static CURLcode qs_disconnect(struct quicsocket *qs)
|
||||
quiche_config_free(qs->cfg);
|
||||
qs->cfg = NULL;
|
||||
}
|
||||
if(qs->conn) {
|
||||
quiche_conn_free(qs->conn);
|
||||
qs->conn = NULL;
|
||||
}
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
@ -111,14 +116,14 @@ static CURLcode quiche_disconnect(struct connectdata *conn,
|
||||
{
|
||||
struct quicsocket *qs = conn->quic;
|
||||
(void)dead_connection;
|
||||
return qs_disconnect(qs);
|
||||
return qs_disconnect(conn, qs);
|
||||
}
|
||||
|
||||
void Curl_quic_disconnect(struct connectdata *conn,
|
||||
int tempindex)
|
||||
{
|
||||
if(conn->transport == TRNSPRT_QUIC)
|
||||
qs_disconnect(&conn->hequic[tempindex]);
|
||||
qs_disconnect(conn, &conn->hequic[tempindex]);
|
||||
}
|
||||
|
||||
static unsigned int quiche_conncheck(struct connectdata *conn,
|
||||
@ -187,6 +192,7 @@ CURLcode Curl_quic_connect(struct connectdata *conn, curl_socket_t sockfd,
|
||||
(void)addr;
|
||||
(void)addrlen;
|
||||
|
||||
qs->sockfd = sockfd;
|
||||
qs->cfg = quiche_config_new(QUICHE_PROTOCOL_VERSION);
|
||||
if(!qs->cfg) {
|
||||
failf(data, "can't create quiche config");
|
||||
@ -337,7 +343,7 @@ CURLcode Curl_quic_is_connected(struct connectdata *conn, int sockindex,
|
||||
|
||||
return result;
|
||||
error:
|
||||
qs_disconnect(qs);
|
||||
qs_disconnect(conn, qs);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ struct quicsocket {
|
||||
quiche_h3_conn *h3c;
|
||||
quiche_h3_config *h3config;
|
||||
uint8_t scid[QUICHE_MAX_CONN_ID_LEN];
|
||||
curl_socket_t sockfd;
|
||||
uint32_t version;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user