changeset 8270:c87a13514abc quic

Allow ngx_queue_frame() to insert frame in the front. Previously a frame could only be inserted after the first element of the list.
author Roman Arutyunyan <arut@nginx.com>
date Mon, 23 Mar 2020 19:42:09 +0300
parents c9c3a73df6e8
children 8e54a17dabee
files src/event/ngx_event_quic.c
diffstat 1 files changed, 5 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/event/ngx_event_quic.c
+++ b/src/event/ngx_event_quic.c
@@ -1142,21 +1142,16 @@ ngx_quic_handle_stream_data_blocked_fram
 static void
 ngx_quic_queue_frame(ngx_quic_connection_t *qc, ngx_quic_frame_t *frame)
 {
-    ngx_quic_frame_t *f;
+    ngx_quic_frame_t  **f;
 
-    if (qc->frames == NULL) {
-        qc->frames = frame;
-        return;
-    }
-
-    for (f = qc->frames; f->next; f = f->next) {
-        if (f->next->level > frame->level) {
+    for (f = &qc->frames; *f; f = &(*f)->next) {
+        if ((*f)->level > frame->level) {
             break;
         }
     }
 
-    frame->next = f->next;
-    f->next = frame;
+    frame->next = *f;
+    *f = frame;
 }