]> git.kaiwu.me - nginx.git/commitdiff
Allow ngx_queue_frame() to insert frame in the front.
authorRoman Arutyunyan <arut@nginx.com>
Mon, 23 Mar 2020 16:42:09 +0000 (19:42 +0300)
committerRoman Arutyunyan <arut@nginx.com>
Mon, 23 Mar 2020 16:42:09 +0000 (19:42 +0300)
Previously a frame could only be inserted after the first element of the list.

src/event/ngx_event_quic.c

index acc6e671abd48fb867f7cb398a00c08e57b9a502..582d3f8ce834085450d5e02bd72e7ccdbba2e517 100644 (file)
@@ -1142,21 +1142,16 @@ ngx_quic_handle_stream_data_blocked_frame(ngx_connection_t *c,
 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;
 }