]> git.kaiwu.me - nginx.git/commitdiff
QUIC: simplified ngx_quic_cbs_recv_rcd()
authorSergey Kandaurov <pluknet@nginx.com>
Wed, 15 Apr 2026 18:22:43 +0000 (22:22 +0400)
committerSergey Kandaurov <s.kandaurov@f5.com>
Thu, 16 Apr 2026 11:25:55 +0000 (15:25 +0400)
There's no need in for-loop, a single buffer is fed at a time.

src/event/quic/ngx_event_quic_ssl.c

index 4e84f8102733444320d7029998c60c1581f9a72f..705f39f6cb05e88171440d3361315d68be7a5349 100644 (file)
@@ -152,27 +152,19 @@ ngx_quic_cbs_recv_rcd(ngx_ssl_conn_t *ssl_conn,
     qc = ngx_quic_get_connection(c);
     ctx = ngx_quic_get_send_ctx(qc, qc->read_level);
 
-    for (cl = ctx->crypto.chain; cl; cl = cl->next) {
-        b = cl->buf;
-
-        if (b->sync) {
-            /* hole */
+    cl = ctx->crypto.chain;
 
-            *data = NULL;
-            *bytes_read = 0;
+    if (cl == NULL || cl->buf->sync) {
+        *data = NULL;
+        *bytes_read = 0;
 
-            break;
-        }
+    } else {
+        b = cl->buf;
 
         *data = b->pos;
         *bytes_read = b->last - b->pos;
-
-        break;
     }
 
-    *data = NULL;
-    *bytes_read = 0;
-
     return 1;
 }