File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
quinn-proto/src/connection/streams Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ pub(super) struct Send {
1515 pub ( super ) connection_blocked : bool ,
1616 /// The reason the peer wants us to stop, if `STOP_SENDING` was received
1717 pub ( super ) stop_reason : Option < VarInt > ,
18+ /// Reusable buf for usage within `write`--empty between calls to `self.write`
19+ chunks : Vec < Bytes > ,
1820}
1921
2022impl Send {
@@ -27,6 +29,7 @@ impl Send {
2729 fin_pending : false ,
2830 connection_blocked : false ,
2931 stop_reason : None ,
32+ chunks : Vec :: new ( ) ,
3033 } )
3134 }
3235
@@ -66,12 +69,12 @@ impl Send {
6669 }
6770 let limit = limit. min ( budget) as usize ;
6871
69- let mut chunks = Vec :: new ( ) ;
70- let source_output = source ( limit, & mut chunks) ;
72+ debug_assert ! ( self . chunks. is_empty ( ) ) ;
73+ let source_output = source ( limit, & mut self . chunks ) ;
7174
7275 let mut written = 0 ;
7376
74- for mut chunk in chunks. drain ( ..) {
77+ for mut chunk in self . chunks . drain ( ..) {
7578 let prefix = chunk. split_to ( chunk. len ( ) . min ( limit - written) ) ;
7679 written += prefix. len ( ) ;
7780 self . pending . write ( prefix) ;
You can’t perform that action at this time.
0 commit comments