Skip to content

Commit 5b2ff3a

Browse files
committed
Merging the fixes for path cahallenge callbacks
2 parents e36eb78 + f5e17ef commit 5b2ff3a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

picoquic/frames.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4762,7 +4762,7 @@ const uint8_t* picoquic_decode_path_response_frame(picoquic_cnx_t* cnx, const ui
47624762
}
47634763
picoquic_reset_path_mtu(path_x);
47644764
}
4765-
if (cnx->are_path_callbacks_enabled &&
4765+
if (cnx->are_path_callbacks_enabled && cnx->callback_fn != NULL &&
47664766
cnx->callback_fn(cnx, path_x->unique_path_id, NULL, 0, picoquic_callback_path_available,
47674767
cnx->callback_ctx, path_x->app_path_ctx) != 0) {
47684768
picoquic_connection_error_ex(cnx, PICOQUIC_TRANSPORT_INTERNAL_ERROR,
@@ -5171,7 +5171,7 @@ uint8_t* picoquic_format_ready_datagram_frame(picoquic_cnx_t* cnx, picoquic_path
51715171
datagram_data_context.is_old_api = 0;
51725172
datagram_data_context.was_called = 0;
51735173

5174-
if ((cnx->callback_fn)(cnx, (cnx->are_path_callbacks_enabled)?path_x->unique_path_id:0, (uint8_t*)&datagram_data_context, allowed_space,
5174+
if (cnx->callback_fn != NULL && (cnx->callback_fn)(cnx, (cnx->are_path_callbacks_enabled)?path_x->unique_path_id:0, (uint8_t*)&datagram_data_context, allowed_space,
51755175
picoquic_callback_prepare_datagram, cnx->callback_ctx, NULL) != 0) {
51765176
/* something went wrong */
51775177
picoquic_log_app_message(cnx, "Prepare datagram returns error 0x%x", PICOQUIC_TRANSPORT_INTERNAL_ERROR);

picoquic/quicctx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,7 +1757,7 @@ void picoquic_delete_path(picoquic_cnx_t* cnx, int path_index)
17571757
}
17581758

17591759
/* Signal to the application */
1760-
if (cnx->are_path_callbacks_enabled &&
1760+
if (cnx->are_path_callbacks_enabled && cnx->callback_fn != NULL &&
17611761
cnx->callback_fn(cnx, path_x->unique_path_id, NULL, 0, picoquic_callback_path_deleted,
17621762
cnx->callback_ctx, path_x->app_path_ctx) != 0) {
17631763
picoquic_connection_error_ex(cnx, PICOQUIC_TRANSPORT_INTERNAL_ERROR, 0, "Path deleted callback failed.");
@@ -1978,7 +1978,7 @@ void picoquic_set_path_challenge(picoquic_cnx_t* cnx, int path_id, uint64_t curr
19781978
/* Reset the path challenge */
19791979
cnx->path[path_id]->first_tuple->challenge_required = 1;
19801980
picoquic_set_tuple_challenge(cnx->path[path_id]->first_tuple, current_time, cnx->quic->use_constant_challenges);
1981-
if (cnx->path[path_id]->first_tuple->challenge_verified && cnx->are_path_callbacks_enabled) {
1981+
if (cnx->path[path_id]->first_tuple->challenge_verified && cnx->are_path_callbacks_enabled && cnx->callback_fn != NULL) {
19821982
if (cnx->callback_fn(cnx, cnx->path[path_id]->unique_path_id, NULL, 0, picoquic_callback_path_suspended,
19831983
cnx->callback_ctx, cnx->path[path_id]->app_path_ctx) != 0) {
19841984
picoquic_connection_error(cnx, PICOQUIC_TRANSPORT_INTERNAL_ERROR, picoquic_frame_type_path_challenge);

0 commit comments

Comments
 (0)