]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
quiche: expire all active transfers on connection close
authorStefan Eissing <stefan@eissing.org>
Tue, 23 Apr 2024 10:51:30 +0000 (12:51 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 24 Apr 2024 06:31:37 +0000 (08:31 +0200)
- when a connection close is detected, all ongoing transfers
  need to expire bc no more POLL events are likely to happen
  for them.

Fixes #13439
Reported-by: Jay Satiro
Closes #13447

lib/vquic/curl_quiche.c

index a93bade8b944270e607850edf78e9c0aafb5d2b0..d91549befe06fc4ee64d153b04ad84a102d01e1c 100644 (file)
@@ -288,6 +288,20 @@ static struct Curl_easy *get_stream_easy(struct Curl_cfilter *cf,
   return NULL;
 }
 
+static void cf_quiche_expire_conn_transfers(struct Curl_cfilter *cf,
+                                            struct Curl_easy *data)
+{
+  struct Curl_easy *sdata;
+
+  DEBUGASSERT(data->multi);
+  CURL_TRC_CF(data, cf, "expiring all transfers on this connection");
+  for(sdata = data->multi->easyp; sdata; sdata = sdata->next) {
+    if(sdata == data || sdata->conn != data->conn)
+      continue;
+    Curl_expire(sdata, 0, EXPIRE_RUN_NOW);
+  }
+}
+
 /*
  * write_resp_raw() copies response data in raw format to the `data`'s
   * receive buffer. If not enough space is available, it appends to the
@@ -686,7 +700,13 @@ static CURLcode cf_flush_egress(struct Curl_cfilter *cf,
   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");
+      if(quiche_conn_is_timed_out(ctx->qconn))
+        failf(data, "connection closed by idle timeout");
+      else
+        failf(data, "connection closed by server");
+      /* Connection timed out, expire all transfers belonging to it
+       * as will not get any more POLL events here. */
+      cf_quiche_expire_conn_transfers(cf, data);
       return CURLE_SEND_ERROR;
     }
   }