File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,7 @@ impl<R: AsyncReadExt + Unpin> DecryptingReader<R> {
221221 value : packet,
222222 next,
223223 } = Packet :: decode (
224+ packet_number,
224225 & self . decrypted_buf
225226 [ self . unread_start ..self . unread_start + 4 + packet_length. inner as usize ] ,
226227 ) ?;
@@ -252,6 +253,7 @@ impl<R: AsyncReadExt + Unpin> DecryptingReader<R> {
252253 value : packet,
253254 next,
254255 } = Packet :: decode (
256+ packet_number,
255257 & self . buf [ self . unread_start ..self . unread_start + 4 + packet_length. inner as usize ] ,
256258 ) ?;
257259 assert ! ( next. is_empty( ) ) ;
@@ -343,7 +345,8 @@ impl<W: AsyncWriteExt + Unpin> EncryptingWriter<W> {
343345}
344346
345347pub struct Packet < ' a > {
346- pub payload : & ' a [ u8 ] ,
348+ pub ( crate ) number : u32 ,
349+ pub ( crate ) payload : & ' a [ u8 ] ,
347350}
348351
349352impl < ' a > Packet < ' a > {
@@ -356,7 +359,7 @@ impl<'a> Packet<'a> {
356359}
357360
358361impl < ' a > Packet < ' a > {
359- fn decode ( bytes : & ' a [ u8 ] ) -> Result < Decoded < ' a , Self > , Error > {
362+ fn decode ( number : u32 , bytes : & ' a [ u8 ] ) -> Result < Decoded < ' a , Self > , Error > {
360363 let Decoded {
361364 value : packet_length,
362365 next,
@@ -391,7 +394,7 @@ impl<'a> Packet<'a> {
391394 // No MAC support yet
392395
393396 Ok ( Decoded {
394- value : Self { payload } ,
397+ value : Self { number , payload } ,
395398 next,
396399 } )
397400 }
Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ impl<
153153 value : MessageType :: Unknown ( v) ,
154154 ..
155155 } ) => {
156+ let sequence_no = packet. number ;
156157 let mut handled = false ;
157158 for service in self . services . iter_mut ( ) {
158159 if service. packet_types ( ) . contains ( & v) {
@@ -162,10 +163,9 @@ impl<
162163 }
163164 }
164165 if !handled {
165- // FIXME: send proper packet sequence number
166166 if let Err ( e) = self
167167 . connection
168- . send_packet ( & UnimplementedMsg { sequence_no : 0 } )
168+ . send_packet ( & UnimplementedMsg { sequence_no } )
169169 . await
170170 {
171171 debug ! ( "Error sending packet: {e}" ) ;
You can’t perform that action at this time.
0 commit comments