@@ -759,9 +759,7 @@ impl Connection {
759759 now,
760760 space_id,
761761 self . rem_cids . active ( ) ,
762- buf. buf ,
763- buf. buf_capacity ,
764- buf. datagram_start ,
762+ & mut buf,
765763 ack_eliciting,
766764 self ,
767765 ) ?) ;
@@ -926,19 +924,12 @@ impl Connection {
926924 . mtud
927925 . poll_transmit ( now, self . packet_number_filter . peek ( & self . spaces [ space_id] ) ) ?;
928926
929- let buf_capacity = probe_size as usize ;
930- buf. buf . reserve ( buf_capacity) ;
927+ buf . buf_capacity = probe_size as usize ;
928+ buf. buf . reserve ( buf . buf_capacity ) ;
931929
932- let mut builder = PacketBuilder :: new (
933- now,
934- space_id,
935- self . rem_cids . active ( ) ,
936- buf. buf ,
937- buf_capacity,
938- 0 ,
939- true ,
940- self ,
941- ) ?;
930+ debug_assert_eq ! ( buf. datagram_start, 0 ) ;
931+ let mut builder =
932+ PacketBuilder :: new ( now, space_id, self . rem_cids . active ( ) , & mut buf, true , self ) ?;
942933
943934 // We implement MTU probes as ping packets padded up to the probe size
944935 buf. write ( frame:: FrameType :: PING ) ;
@@ -995,7 +986,11 @@ impl Connection {
995986 }
996987
997988 /// Send PATH_CHALLENGE for a previous path if necessary
998- fn send_path_challenge ( & mut self , now : Instant , buf : & mut TransmitBuf < ' _ > ) -> Option < Transmit > {
989+ fn send_path_challenge (
990+ & mut self ,
991+ now : Instant ,
992+ mut buf : & mut TransmitBuf < ' _ > ,
993+ ) -> Option < Transmit > {
999994 let ( prev_cid, prev_path) = self . prev_path . as_mut ( ) ?;
1000995 if !prev_path. challenge_pending {
1001996 return None ;
@@ -1012,23 +1007,15 @@ impl Connection {
10121007 ) ;
10131008 buf. buf . reserve ( MIN_INITIAL_SIZE as usize ) ;
10141009
1015- let buf_capacity = buf. buf . capacity ( ) ;
1010+ buf . buf_capacity = buf. buf . capacity ( ) ;
10161011
10171012 // Use the previous CID to avoid linking the new path with the previous path. We
10181013 // don't bother accounting for possible retirement of that prev_cid because this is
10191014 // sent once, immediately after migration, when the CID is known to be valid. Even
10201015 // if a post-migration packet caused the CID to be retired, it's fair to pretend
10211016 // this is sent first.
1022- let mut builder = PacketBuilder :: new (
1023- now,
1024- SpaceId :: Data ,
1025- * prev_cid,
1026- buf. buf ,
1027- buf_capacity,
1028- 0 ,
1029- false ,
1030- self ,
1031- ) ?;
1017+ debug_assert_eq ! ( buf. datagram_start, 0 ) ;
1018+ let mut builder = PacketBuilder :: new ( now, SpaceId :: Data , * prev_cid, buf, false , self ) ?;
10321019 trace ! ( "validating previous path with PATH_CHALLENGE {:08x}" , token) ;
10331020 buf. write ( frame:: FrameType :: PATH_CHALLENGE ) ;
10341021 buf. write ( token) ;
0 commit comments