]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cf-ngtcp2-cmn: de-duplicate `ngtcp2_conn_client_new()` call code
authorViktor Szakats <commit@vsz.me>
Sun, 26 Jul 2026 18:48:02 +0000 (20:48 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 27 Jul 2026 08:17:15 +0000 (10:17 +0200)
Closes #22401

lib/vquic/cf-ngtcp2-cmn.c

index c474fdbdc54908a8ec94f227dc5965a2af4fc5ca..9cc3cad5c0f79541ea4ebb99fb7217008cbf8561 100644 (file)
@@ -951,17 +951,6 @@ static CURLcode cf_connect_start(struct Curl_cfilter *cf,
                      ctx->q.local_addrlen);
     ngtcp2_addr_init(&ctx->connected_path.remote,
                      &sockaddr->curl_sa_addr, (socklen_t)sockaddr->addrlen);
-
-    rc = ngtcp2_conn_client_new(&ctx->qconn, &ctx->dcid, &ctx->scid,
-                                &ctx->connected_path,
-                                NGTCP2_PROTO_VER_V1, &ng_callbacks,
-                                &ctx->settings, &ctx->transport_params,
-                                Curl_ngtcp2_mem(), cf);
-    if(rc)
-      return CURLE_QUIC_CONNECT_ERROR;
-
-    ctx->conn_ref.get_conn = get_conn;
-    ctx->conn_ref.user_data = cf;
   }
   else {
     /* Tunneled QUIC (e.g. CONNECT-UDP): get remote address
@@ -995,18 +984,18 @@ static CURLcode cf_connect_start(struct Curl_cfilter *cf,
     ngtcp2_addr_init(&ctx->connected_path.remote,
                      &remote->curl_sa_addr,
                      (socklen_t)remote->addrlen);
+  }
 
-    rc = ngtcp2_conn_client_new(&ctx->qconn, &ctx->dcid, &ctx->scid,
-                                &ctx->connected_path,
-                                NGTCP2_PROTO_VER_V1, &ng_callbacks,
-                                &ctx->settings, &ctx->transport_params,
-                                Curl_ngtcp2_mem(), cf);
-    if(rc)
-      return CURLE_QUIC_CONNECT_ERROR;
+  rc = ngtcp2_conn_client_new(&ctx->qconn, &ctx->dcid, &ctx->scid,
+                              &ctx->connected_path,
+                              NGTCP2_PROTO_VER_V1, &ng_callbacks,
+                              &ctx->settings, &ctx->transport_params,
+                              Curl_ngtcp2_mem(), cf);
+  if(rc)
+    return CURLE_QUIC_CONNECT_ERROR;
 
-    ctx->conn_ref.get_conn = get_conn;
-    ctx->conn_ref.user_data = cf;
-  }
+  ctx->conn_ref.get_conn = get_conn;
+  ctx->conn_ref.user_data = cf;
 
   result = Curl_vquic_tls_init(&ctx->tls, cf, data,
                                &ctx->ssl_peer, &ALPN_SPEC_H3,