]> git.kaiwu.me - nginx.git/commitdiff
Removed source/destination swap from the function creating header.
authorVladimir Homutov <vl@nginx.com>
Mon, 20 Apr 2020 09:12:17 +0000 (12:12 +0300)
committerVladimir Homutov <vl@nginx.com>
Mon, 20 Apr 2020 09:12:17 +0000 (12:12 +0300)
The function now creates a header according to fileds provided in the "pkt"
argument without applying any logic regarding sending side.

src/event/ngx_event_quic.c
src/event/ngx_event_quic_transport.c

index 4c9a658a95c3a254d5648549adeb754f4447a91b..990c1ec1443282e2fda3138caff38ff0c67aa5bf 100644 (file)
@@ -2233,8 +2233,8 @@ ngx_quic_send_frames(ngx_connection_t *c, ngx_queue_t *frames)
 
     pkt.log = c->log;
     pkt.level = start->level;
-    pkt.dcid = qc->dcid;
-    pkt.scid = qc->scid;
+    pkt.dcid = qc->scid;
+    pkt.scid = qc->dcid;
     pkt.payload = out;
 
     res.data = dst;
index e291c1215ecb15c1c0ab2d68dc0b5f91267d3a24..1a2cada3547d885fe507cdeaa1d980f1f9966538 100644 (file)
@@ -365,12 +365,12 @@ ngx_quic_create_long_header(ngx_quic_header_t *pkt, u_char *out,
 
     p = ngx_quic_write_uint32(p, NGX_QUIC_VERSION);
 
-    *p++ = pkt->scid.len;
-    p = ngx_cpymem(p, pkt->scid.data, pkt->scid.len);
-
     *p++ = pkt->dcid.len;
     p = ngx_cpymem(p, pkt->dcid.data, pkt->dcid.len);
 
+    *p++ = pkt->scid.len;
+    p = ngx_cpymem(p, pkt->scid.data, pkt->scid.len);
+
     if (pkt->level == ssl_encryption_initial) {
         ngx_quic_build_int(&p, pkt->token.len);
     }
@@ -408,7 +408,7 @@ ngx_quic_create_short_header(ngx_quic_header_t *pkt, u_char *out,
 
     *p++ = pkt->flags;
 
-    p = ngx_cpymem(p, pkt->scid.data, pkt->scid.len);
+    p = ngx_cpymem(p, pkt->dcid.data, pkt->dcid.len);
 
     *pnp = p;