Skip to content

Commit fe150dd

Browse files
committed
Fix bypass in ready mode
1 parent 000c0c2 commit fe150dd

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

picoquic/sender.c

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3749,15 +3749,28 @@ int picoquic_prepare_packet_ready(picoquic_cnx_t* cnx, picoquic_path_t* path_x,
37493749

37503750
if ((path_x->cwin < path_x->bytes_in_transit || cnx->quic->cwin_max < path_x->bytes_in_transit)
37513751
&&!path_x->is_pto_required) {
3752-
cnx->cwin_blocked = 1;
3753-
path_x->last_cwin_blocked_time = current_time;
3754-
if (cnx->congestion_alg != NULL) {
3755-
picoquic_per_ack_state_t ack_state = { 0 };
3756-
3757-
cnx->congestion_alg->alg_notify(cnx, path_x,
3758-
picoquic_congestion_notification_cwin_blocked,
3759-
&ack_state, current_time);
3760-
}
3752+
/* Implementation of experimental API, picoquic_set_priority_limit_for_bypass */
3753+
uint8_t* bytes_next_before_bypass = bytes_next;
3754+
int no_data_to_send = 0;
3755+
if (cnx->priority_limit_for_bypass > 0 && cnx->nb_paths == 1) {
3756+
bytes_next = picoquic_prepare_stream_and_datagrams(cnx, path_x, bytes_next, bytes_max,
3757+
cnx->priority_limit_for_bypass,
3758+
&more_data, &is_pure_ack, &no_data_to_send, &ret);
3759+
}
3760+
if (bytes_next != bytes_next_before_bypass) {
3761+
length = bytes_next - bytes;
3762+
}
3763+
else {
3764+
cnx->cwin_blocked = 1;
3765+
path_x->last_cwin_blocked_time = current_time;
3766+
if (cnx->congestion_alg != NULL) {
3767+
picoquic_per_ack_state_t ack_state = { 0 };
3768+
3769+
cnx->congestion_alg->alg_notify(cnx, path_x,
3770+
picoquic_congestion_notification_cwin_blocked,
3771+
&ack_state, current_time);
3772+
}
3773+
}
37613774
}
37623775
else {
37633776
/* Send here the frames that are subject to both congestion and pacing control.
@@ -3865,6 +3878,16 @@ int picoquic_prepare_packet_ready(picoquic_cnx_t* cnx, picoquic_path_t* path_x,
38653878
}
38663879
} /* end of CC */
38673880
} /* End of pacing */
3881+
else if (cnx->priority_limit_for_bypass > 0 && cnx->nb_paths == 1) {
3882+
/* If congestion bypass is implemented, also consider pacing bypass */
3883+
int no_data_to_send = 0;
3884+
3885+
if ((bytes_next = picoquic_prepare_stream_and_datagrams(cnx, path_x, bytes_next, bytes_max,
3886+
cnx->priority_limit_for_bypass,
3887+
&more_data, &is_pure_ack, &no_data_to_send, &ret)) != NULL) {
3888+
length = bytes_next - bytes;
3889+
}
3890+
}
38683891
} /* End of challenge verified */
38693892
}
38703893

0 commit comments

Comments
 (0)