@@ -1780,6 +1780,55 @@ fn congested_tail_loss() {
17801780 pair. client_send ( client_ch, s) . write ( & [ 42 ; 1024 ] ) . unwrap ( ) ;
17811781}
17821782
1783+ // Send a tail-loss probe when GSO segment_size is less than INITIAL_MTU
1784+ #[ test]
1785+ fn tail_loss_small_segment_size ( ) {
1786+ let _guard = subscribe ( ) ;
1787+ let mut pair = Pair :: default ( ) ;
1788+ let ( client_ch, server_ch) = pair. connect ( ) ;
1789+
1790+ // No datagrams frames received in the handshake.
1791+ let server_stats = pair. server_conn_mut ( server_ch) . stats ( ) ;
1792+ assert_eq ! ( server_stats. frame_rx. datagram, 0 ) ;
1793+
1794+ const DGRAM_LEN : usize = 1000 ; // Below INITIAL_MTU after packet overhead.
1795+ const DGRAM_NUM : u64 = 5 ; // Enough to build a GSO batch.
1796+
1797+ info ! ( "Sending an ack-eliciting datagram" ) ;
1798+ pair. client_conn_mut ( client_ch) . ping ( ) ;
1799+ pair. drive_client ( ) ;
1800+
1801+ // Drop these packets on the server side.
1802+ assert ! ( !pair. server. inbound. is_empty( ) ) ;
1803+ pair. server . inbound . clear ( ) ;
1804+
1805+ // Doing one step makes the client advance time to the PTO fire time.
1806+ info ! ( "stepping forward to PTO" ) ;
1807+ pair. step ( ) ;
1808+
1809+ // Still no datagrams frames received by the server.
1810+ let server_stats = pair. server_conn_mut ( server_ch) . stats ( ) ;
1811+ assert_eq ! ( server_stats. frame_rx. datagram, 0 ) ;
1812+
1813+ // Now we can send another batch of datagrams, so the PTO can send them instead of
1814+ // sending a ping. These are small enough that the segment_size is less than the
1815+ // INITIAL_MTU.
1816+ info ! ( "Sending datagram batch" ) ;
1817+ for _ in 0 ..DGRAM_NUM {
1818+ pair. client_datagrams ( client_ch)
1819+ . send ( vec ! [ 0 ; DGRAM_LEN ] . into ( ) , false )
1820+ . unwrap ( ) ;
1821+ }
1822+
1823+ // If this succeeds the datagrams are received by the server and the client did not
1824+ // crash.
1825+ pair. drive ( ) ;
1826+
1827+ // Finally the server should have received some datagrams.
1828+ let server_stats = pair. server_conn_mut ( server_ch) . stats ( ) ;
1829+ assert_eq ! ( server_stats. frame_rx. datagram, DGRAM_NUM ) ;
1830+ }
1831+
17831832#[ test]
17841833fn datagram_send_recv ( ) {
17851834 let _guard = subscribe ( ) ;
0 commit comments