@@ -128,6 +128,7 @@ struct sm_fake_connection {
128128 struct h2_fake_peer peer ;
129129 struct aws_http_client_connection_options options ;
130130 struct aws_http_connection * connection ;
131+ size_t last_completed_frame_index ; /* Track the last frame index we've completed */
131132};
132133
133134static void s_testing_channel_shutdown (int error_code , void * user_data ) {
@@ -358,7 +359,8 @@ static void s_fake_connection_complete_streams(
358359 aws_http_headers_add_array (response_headers , response_headers_src , AWS_ARRAY_SIZE (response_headers_src ));
359360 size_t frames_count = h2_decode_tester_frame_count (& fake_connection -> peer .decode );
360361 int streams_completed = 0 ;
361- for (size_t i = 0 ; i < frames_count ; ++ i ) {
362+ /* Start from the last completed frame index to avoid re-completing streams */
363+ for (size_t i = fake_connection -> last_completed_frame_index ; i < frames_count ; ++ i ) {
362364 struct h2_decoded_frame * frame = h2_decode_tester_get_frame (& fake_connection -> peer .decode , i );
363365 if (frame -> end_stream ) {
364366 struct aws_h2_frame * response_frame = aws_h2_frame_new_headers (
@@ -372,6 +374,8 @@ static void s_fake_connection_complete_streams(
372374 aws_byte_cursor_from_c_str ("tests" ),
373375 true /*end_stream*/ ) == AWS_OP_SUCCESS );
374376 }
377+ /* Update the last completed frame index */
378+ fake_connection -> last_completed_frame_index = i + 1 ;
375379 if (num_streams_to_complete && ++ streams_completed >= num_streams_to_complete ) {
376380 break ;
377381 }
0 commit comments