@@ -2931,7 +2931,7 @@ static uint8_t* picoquic_prepare_datagram_ready(picoquic_cnx_t* cnx, picoquic_pa
2931
2931
*/
2932
2932
2933
2933
static uint8_t * picoquic_prepare_stream_and_datagrams (picoquic_cnx_t * cnx , picoquic_path_t * path_x , uint8_t * bytes_next , uint8_t * bytes_max ,
2934
- uint64_t max_priority_allowed ,
2934
+ uint64_t max_priority_allowed , uint64_t current_time ,
2935
2935
int * more_data , int * is_pure_ack , int * no_data_to_send , int * ret )
2936
2936
{
2937
2937
int datagram_sent = 0 ;
@@ -2950,6 +2950,7 @@ static uint8_t* picoquic_prepare_stream_and_datagrams(picoquic_cnx_t* cnx, picoq
2950
2950
picoquic_packet_t * first_repeat = picoquic_first_data_repeat_packet (cnx );
2951
2951
uint64_t current_priority = UINT64_MAX ;
2952
2952
uint64_t stream_priority = UINT64_MAX ;
2953
+ uint8_t * bytes_before_iteration = bytes_next ;
2953
2954
int something_sent = 0 ;
2954
2955
int conflict_found = 0 ;
2955
2956
@@ -3030,6 +3031,12 @@ static uint8_t* picoquic_prepare_stream_and_datagrams(picoquic_cnx_t* cnx, picoq
3030
3031
more_data , is_pure_ack , & datagram_tried_and_failed , & datagram_sent , ret );
3031
3032
something_sent = datagram_sent ;
3032
3033
}
3034
+
3035
+ if (current_priority < cnx -> priority_limit_for_bypass && bytes_next > bytes_before_iteration ) {
3036
+ picoquic_update_pacing_data_after_send (& cnx -> priority_bypass_pacing , bytes_next - bytes_before_iteration ,
3037
+ cnx -> path [0 ]-> send_mtu , current_time );
3038
+ }
3039
+
3033
3040
if (is_first_round ) {
3034
3041
* no_data_to_send = ((first_stream == NULL && first_repeat == NULL ) || stream_tried_and_failed ) &&
3035
3042
(!datagram_present || datagram_tried_and_failed );
@@ -3174,25 +3181,13 @@ int picoquic_prepare_packet_almost_ready(picoquic_cnx_t* cnx, picoquic_path_t* p
3174
3181
3175
3182
length = bytes_next - bytes ;
3176
3183
if (path_x -> cwin < path_x -> bytes_in_transit ) {
3177
- /* Implementation of experimental API, picoquic_set_priority_limit_for_bypass */
3178
- uint8_t * bytes_next_before_bypass = bytes_next ;
3179
- if (cnx -> priority_limit_for_bypass > 0 && cnx -> nb_paths == 1 ) {
3180
- bytes_next = picoquic_prepare_stream_and_datagrams (cnx , path_x , bytes_next , bytes_max ,
3181
- cnx -> priority_limit_for_bypass ,
3182
- & more_data , & is_pure_ack , & no_data_to_send , & ret );
3183
- }
3184
- if (bytes_next != bytes_next_before_bypass ) {
3185
- length = bytes_next - bytes ;
3186
- }
3187
- else {
3188
- picoquic_per_ack_state_t ack_state = { 0 };
3189
- cnx -> cwin_blocked = 1 ;
3190
- path_x -> last_cwin_blocked_time = current_time ;
3191
- if (cnx -> congestion_alg != NULL ) {
3192
- cnx -> congestion_alg -> alg_notify (cnx , path_x ,
3193
- picoquic_congestion_notification_cwin_blocked ,
3194
- & ack_state , current_time );
3195
- }
3184
+ picoquic_per_ack_state_t ack_state = { 0 };
3185
+ cnx -> cwin_blocked = 1 ;
3186
+ path_x -> last_cwin_blocked_time = current_time ;
3187
+ if (cnx -> congestion_alg != NULL ) {
3188
+ cnx -> congestion_alg -> alg_notify (cnx , path_x ,
3189
+ picoquic_congestion_notification_cwin_blocked ,
3190
+ & ack_state , current_time );
3196
3191
}
3197
3192
}
3198
3193
else {
@@ -3234,7 +3229,7 @@ int picoquic_prepare_packet_almost_ready(picoquic_cnx_t* cnx, picoquic_path_t* p
3234
3229
}
3235
3230
if (ret == 0 ) {
3236
3231
bytes_next = picoquic_prepare_stream_and_datagrams (cnx , path_x , bytes_next , bytes_max ,
3237
- UINT64_MAX ,
3232
+ UINT64_MAX , current_time ,
3238
3233
& more_data , & is_pure_ack , & no_data_to_send , & ret );
3239
3234
}
3240
3235
/* TODO: replace this by posting of frame when CWIN estimated */
@@ -3533,9 +3528,11 @@ int picoquic_prepare_packet_ready(picoquic_cnx_t* cnx, picoquic_path_t* path_x,
3533
3528
/* Implementation of experimental API, picoquic_set_priority_limit_for_bypass */
3534
3529
uint8_t * bytes_next_before_bypass = bytes_next ;
3535
3530
int no_data_to_send = 0 ;
3536
- if (cnx -> priority_limit_for_bypass > 0 && cnx -> nb_paths == 1 ) {
3531
+ if (cnx -> priority_limit_for_bypass > 0 && cnx -> nb_paths == 1 &&
3532
+ picoquic_is_authorized_by_pacing (& cnx -> priority_bypass_pacing , current_time , next_wake_time ,
3533
+ cnx -> quic -> packet_train_mode , cnx -> quic )) {
3537
3534
bytes_next = picoquic_prepare_stream_and_datagrams (cnx , path_x , bytes_next , bytes_max ,
3538
- cnx -> priority_limit_for_bypass ,
3535
+ cnx -> priority_limit_for_bypass , current_time ,
3539
3536
& more_data , & is_pure_ack , & no_data_to_send , & ret );
3540
3537
}
3541
3538
if (bytes_next != bytes_next_before_bypass ) {
@@ -3582,8 +3579,8 @@ int picoquic_prepare_packet_ready(picoquic_cnx_t* cnx, picoquic_path_t* path_x,
3582
3579
bytes_next = picoquic_format_ack_frequency_frame (cnx , bytes_next , bytes_max , & more_data );
3583
3580
}
3584
3581
if (ret == 0 ) {
3585
- bytes_next = picoquic_prepare_stream_and_datagrams (cnx , path_x , bytes_next , bytes_max , UINT64_MAX ,
3586
- & more_data , & is_pure_ack , & no_data_to_send , & ret );
3582
+ bytes_next = picoquic_prepare_stream_and_datagrams (cnx , path_x , bytes_next , bytes_max ,
3583
+ UINT64_MAX , current_time , & more_data , & is_pure_ack , & no_data_to_send , & ret );
3587
3584
}
3588
3585
3589
3586
/* TODO: replace this by scheduling of BDP frame when window has been estimated */
@@ -3659,12 +3656,14 @@ int picoquic_prepare_packet_ready(picoquic_cnx_t* cnx, picoquic_path_t* path_x,
3659
3656
}
3660
3657
} /* end of CC */
3661
3658
} /* End of pacing */
3662
- else if (cnx -> priority_limit_for_bypass > 0 && cnx -> nb_paths == 1 ) {
3659
+ else if (cnx -> priority_limit_for_bypass > 0 && cnx -> nb_paths == 1 &&
3660
+ picoquic_is_authorized_by_pacing (& cnx -> priority_bypass_pacing , current_time , next_wake_time ,
3661
+ cnx -> quic -> packet_train_mode , cnx -> quic )) {
3663
3662
/* If congestion bypass is implemented, also consider pacing bypass */
3664
3663
int no_data_to_send = 0 ;
3665
-
3664
+
3666
3665
if ((bytes_next = picoquic_prepare_stream_and_datagrams (cnx , path_x , bytes_next , bytes_max ,
3667
- cnx -> priority_limit_for_bypass ,
3666
+ cnx -> priority_limit_for_bypass , current_time ,
3668
3667
& more_data , & is_pure_ack , & no_data_to_send , & ret )) != NULL ) {
3669
3668
length = bytes_next - bytes ;
3670
3669
}
0 commit comments