@@ -2905,7 +2905,7 @@ static void test_rx_session_unordered(void)
29052905}
29062906
29072907/// Ensure the reassembler can detect repeated transfers even after the window has moved past them.
2908- static void test_rx_session_history (void )
2908+ static void test_rx_session_unordered_reject_old (void )
29092909{
29102910 instrumented_allocator_t alloc_frag = { 0 };
29112911 instrumented_allocator_new (& alloc_frag );
@@ -2939,6 +2939,8 @@ static void test_rx_session_history(void)
29392939 & fac_args ,
29402940 & cavl_factory_rx_session_by_remote_uid );
29412941 TEST_ASSERT_NOT_NULL (ses );
2942+
2943+ // Send transfer #10. It should be accepted.
29422944 meta_t meta = { .priority = udpard_prio_fast ,
29432945 .flag_ack = false,
29442946 .transfer_payload_size = 3 ,
@@ -2955,6 +2957,8 @@ static void test_rx_session_history(void)
29552957 0 );
29562958 TEST_ASSERT_EQUAL (1 , cb_result .message .count );
29572959 TEST_ASSERT_EQUAL (10 , cb_result .message .history [0 ].transfer_id );
2960+
2961+ // Send transfer with a very different TID outside the window (a "jump"). It should be accepted also.
29582962 const uint64_t jump_tid = 10 + RX_TRANSFER_ID_WINDOW_BITS + 5U ;
29592963 meta .transfer_id = jump_tid ;
29602964 meta .transfer_payload_size = 4 ;
@@ -2969,6 +2973,8 @@ static void test_rx_session_history(void)
29692973 TEST_ASSERT_EQUAL (2 , cb_result .message .count );
29702974 TEST_ASSERT_EQUAL (jump_tid , cb_result .message .history [0 ].transfer_id );
29712975 TEST_ASSERT_FALSE (rx_transfer_id_window_contains (& ses -> tidwin , 10 ));
2976+
2977+ // Send transfer #10 again. It should be rejected as a duplicate.
29722978 meta .transfer_id = 10 ;
29732979 meta .transfer_payload_size = 3 ;
29742980 meta .flag_ack = true;
@@ -2980,7 +2986,7 @@ static void test_rx_session_history(void)
29802986 make_frame (meta , mem_payload , "dup" , 0 , 3 ),
29812987 del_payload ,
29822988 0 );
2983- TEST_ASSERT_EQUAL (2 , cb_result .message .count );
2989+ TEST_ASSERT_EQUAL (2 , cb_result .message .count ); // no new message
29842990 TEST_ASSERT_EQUAL (1 , cb_result .ack_mandate .count );
29852991 TEST_ASSERT_EQUAL (10 , cb_result .ack_mandate .am .transfer_id );
29862992 TEST_ASSERT_EQUAL_size_t (3 , cb_result .ack_mandate .am .payload_head .size );
@@ -2996,7 +3002,7 @@ static void test_rx_session_history(void)
29963002 instrumented_allocator_reset (& alloc_payload );
29973003}
29983004
2999- // Send transfers 1, 3, 10000, 2 in the ORDERED mode; ensure 2 is rejected because it's late after 3.
3005+ /// Send transfers 1, 3, 10000, 2 in the ORDERED mode; ensure 2 is rejected because it's late after 3.
30003006static void test_rx_session_ordered_reject_stale_after_jump (void )
30013007{
30023008 instrumented_allocator_t alloc_frag = { 0 };
@@ -3859,7 +3865,7 @@ int main(void)
38593865
38603866 RUN_TEST (test_rx_session_ordered );
38613867 RUN_TEST (test_rx_session_unordered );
3862- RUN_TEST (test_rx_session_history );
3868+ RUN_TEST (test_rx_session_unordered_reject_old );
38633869 RUN_TEST (test_rx_session_ordered_reject_stale_after_jump );
38643870
38653871 RUN_TEST (test_rx_port );
0 commit comments