]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
quiche: enable quiche to handle timeout events
authortrrui-huawei <oldduckruirui@gmail.com>
Fri, 11 Aug 2023 06:14:11 +0000 (14:14 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 15 Aug 2023 12:38:31 +0000 (14:38 +0200)
In parallel with ngtcp2, quiche also offers the `quiche_conn_on_timeout`
interface for the application to invoke upon timer
expiration. Therefore, invoking the `on_timeout` function of the
Connection is crucial to ensure seamless functionality of quiche with
timeout events.

Closes #11654

lib/vquic/curl_quiche.c

index 298439a2476cc6954b686e71de2ed9214361884d..bbb069096ed21382db0dfb20a5e7cc854c6202e3 100644 (file)
@@ -747,10 +747,20 @@ static CURLcode cf_flush_egress(struct Curl_cfilter *cf,
   struct cf_quiche_ctx *ctx = cf->ctx;
   ssize_t nread;
   CURLcode result;
+  int64_t expiry_ns;
   int64_t timeout_ns;
   struct read_ctx readx;
   size_t pkt_count, gsolen;
 
+  expiry_ns = quiche_conn_timeout_as_nanos(ctx->qconn);
+  if(!expiry_ns) {
+    quiche_conn_on_timeout(ctx->qconn);
+    if(quiche_conn_is_closed(ctx->qconn)) {
+      failf(data, "quiche_conn_on_timeout closed the connection");
+      return CURLE_SEND_ERROR;
+    }
+  }
+
   result = vquic_flush(cf, data, &ctx->q);
   if(result) {
     if(result == CURLE_AGAIN) {