@@ -756,11 +756,10 @@ impl<'a> TcpSocket<'a> {
756
756
( ip_reply_repr, reply_repr)
757
757
}
758
758
759
- pub ( crate ) fn ack_reply ( & self , ip_repr : & IpRepr , repr : & TcpRepr ) ->
760
- ( IpRepr , TcpRepr < ' static > ) {
759
+ fn ack_reply ( & self , ip_repr : & IpRepr , repr : & TcpRepr ) -> ( IpRepr , TcpRepr < ' static > ) {
761
760
let ( ip_reply_repr, mut reply_repr) = Self :: reply ( ip_repr, repr) ;
762
761
763
- // From RFC793 :
762
+ // From RFC 793 :
764
763
// [...] an empty acknowledgment segment containing the current send-sequence number
765
764
// and an acknowledgment indicating the next sequence number expected
766
765
// to be received.
@@ -1338,6 +1337,7 @@ impl<'a> TcpSocket<'a> {
1338
1337
repr. max_seg_size = Some ( max_segment_size as u16 ) ;
1339
1338
}
1340
1339
1340
+ ip_repr. set_payload_len ( repr. buffer_len ( ) ) ;
1341
1341
emit ( ( ip_repr, repr) ) ?;
1342
1342
1343
1343
// We've sent something, whether useful data or a keep-alive packet, so rewind
@@ -1481,6 +1481,7 @@ mod test {
1481
1481
assert_eq ! ( ip_repr. protocol( ) , IpProtocol :: Tcp ) ;
1482
1482
assert_eq ! ( ip_repr. src_addr( ) , LOCAL_IP ) ;
1483
1483
assert_eq ! ( ip_repr. dst_addr( ) , REMOTE_IP ) ;
1484
+ assert_eq ! ( ip_repr. payload_len( ) , tcp_repr. buffer_len( ) ) ;
1484
1485
1485
1486
trace ! ( "recv: {}" , tcp_repr) ;
1486
1487
Ok ( f ( Ok ( tcp_repr) ) )
0 commit comments