comparison src/event/ngx_event_quic_transport.c @ 8558:0f37b4ef3cd9 quic

QUIC: keep the entire packet size in pkt->len. Previously pkt->len kept the length of the packet remainder starting from pkt->raw->pos.
author Roman Arutyunyan <arut@nginx.com>
date Fri, 25 Sep 2020 21:46:55 +0300
parents d3489d225f8f
children a89a58c642ef
comparison
equal deleted inserted replaced
8557:2727d402e5a5 8558:0f37b4ef3cd9
509 "quic packet is too small to read dcid"); 509 "quic packet is too small to read dcid");
510 return NGX_ERROR; 510 return NGX_ERROR;
511 } 511 }
512 512
513 pkt->raw->pos = p; 513 pkt->raw->pos = p;
514 pkt->len = end - p;
515 514
516 return NGX_OK; 515 return NGX_OK;
517 } 516 }
518 517
519 518
559 "quic truncated initial packet"); 558 "quic truncated initial packet");
560 return NGX_ERROR; 559 return NGX_ERROR;
561 } 560 }
562 561
563 pkt->raw->pos = p; 562 pkt->raw->pos = p;
564 pkt->len = varint; 563 pkt->len = p + varint - pkt->data;
565 564
566 #ifdef NGX_QUIC_DEBUG_PACKETS 565 #ifdef NGX_QUIC_DEBUG_PACKETS
567 ngx_quic_hexdump(pkt->log, "quic DCID", pkt->dcid.data, pkt->dcid.len); 566 ngx_quic_hexdump(pkt->log, "quic DCID", pkt->dcid.data, pkt->dcid.len);
568 ngx_quic_hexdump(pkt->log, "quic SCID", pkt->scid.data, pkt->scid.len); 567 ngx_quic_hexdump(pkt->log, "quic SCID", pkt->scid.data, pkt->scid.len);
569 ngx_quic_hexdump(pkt->log, "quic token", pkt->token.data, pkt->token.len); 568 ngx_quic_hexdump(pkt->log, "quic token", pkt->token.data, pkt->token.len);
598 "quic truncated handshake packet"); 597 "quic truncated handshake packet");
599 return NGX_ERROR; 598 return NGX_ERROR;
600 } 599 }
601 600
602 pkt->raw->pos = p; 601 pkt->raw->pos = p;
603 pkt->len = plen; 602 pkt->len = p + plen - pkt->data;
604 603
605 return NGX_OK; 604 return NGX_OK;
606 } 605 }
607 606
608 607