From 14417fb0e615596cf3dd80b058c65f2c806cab0f Mon Sep 17 00:00:00 2001 From: Christian Huitema Date: Sat, 16 Mar 2024 13:27:24 -0700 Subject: [PATCH] Send abandon in response to abandon. --- picoquic/frames.c | 14 ++++++++++++-- picoquic/picoquic_internal.h | 1 + picoquic/quicctx.c | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/picoquic/frames.c b/picoquic/frames.c index ddde42d1f..6b5a0aa8c 100644 --- a/picoquic/frames.c +++ b/picoquic/frames.c @@ -5345,11 +5345,21 @@ const uint8_t* picoquic_decode_path_abandon_frame(const uint8_t* bytes, const ui int path_number = (cnx->is_unique_path_id_enabled)? picoquic_find_path_by_unique_id(cnx, path_id): picoquic_find_path_by_cnxid_id(cnx, 1, path_id); - if (path_number < 0 || cnx->path[path_number]->path_is_demoted) { + if (path_number < 0) { /* Invalid path ID. Just ignore this frame. Add line in log for debug */ - picoquic_log_app_message(cnx, "Ignore abandon path with invalid ID: %" PRIu64 ",%" PRIu64, + picoquic_log_app_message(cnx, "Ignore abandon path with invalid ID: %" PRIu64, path_id); } + else if (cnx->path[path_number]->path_is_demoted) { + if (!cnx->path[path_number]->path_abandon_received) { + cnx->path[path_number]->path_abandon_received = 1; + } + else { + /* Already abandoned... */ + picoquic_log_app_message(cnx, "Ignore redundant abandon path with ID: %" PRIu64, + path_id); + } + } else { cnx->path[path_number]->path_abandon_received = 1; picoquic_demote_path(cnx, path_number, current_time, 0, NULL); diff --git a/picoquic/picoquic_internal.h b/picoquic/picoquic_internal.h index 59f0cb17e..c9b2c7252 100644 --- a/picoquic/picoquic_internal.h +++ b/picoquic/picoquic_internal.h @@ -1061,6 +1061,7 @@ typedef struct st_picoquic_path_t { unsigned int path_is_standby : 1; unsigned int path_is_demoted : 1; unsigned int path_abandon_received : 1; + unsigned int path_abandon_sent : 1; unsigned int current_spin : 1; unsigned int last_bw_estimate_path_limited : 1; unsigned int path_cid_rotated : 1; diff --git a/picoquic/quicctx.c b/picoquic/quicctx.c index 75a075593..891ee8feb 100644 --- a/picoquic/quicctx.c +++ b/picoquic/quicctx.c @@ -1819,7 +1819,7 @@ void picoquic_demote_path(picoquic_cnx_t* cnx, int path_index, uint64_t current_ /* if in multipath, call "retransmit on path demoted" */ if (cnx->is_multipath_enabled || cnx->is_simple_multipath_enabled || cnx->is_unique_path_id_enabled) { - if (!cnx->path[path_index]->path_abandon_received) { + if (!cnx->path[path_index]->path_abandon_sent) { uint8_t buffer[512]; uint8_t* end_bytes; int more_data = 0; @@ -1835,7 +1835,7 @@ void picoquic_demote_path(picoquic_cnx_t* cnx, int path_index, uint64_t current_ cnx->path[path_index]->unique_path_id); } } - picoquic_retransmit_demoted_path(cnx, cnx->path[path_index], current_time); + /* let's not retransmit immediately -- wait for normal processing instead */ } } }