Skip to content

Commit

Permalink
[~] adjust return value and fix old bug of casting
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanmei-Liu committed Dec 4, 2024
1 parent 2fd8e79 commit f16e252
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/transport/xqc_cid.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ xqc_cid_set_get_largest_seq_or_rpt(xqc_cid_set_t *cid_set, uint64_t path_id)
return inner_set->largest_scid_seq_num;
}
/* if the path id is larger than expected, should return 0 here */
return 0;
return XQC_ERROR;
}

xqc_int_t
Expand Down
21 changes: 12 additions & 9 deletions src/transport/xqc_frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,8 @@ xqc_process_new_conn_id_frame(xqc_connection_t *conn, xqc_packet_in_t *packet_in
{
xqc_int_t ret = XQC_ERROR;
xqc_cid_t new_conn_cid;
uint64_t retire_prior_to, curr_rpi;
uint64_t retire_prior_to = 0;
int64_t curr_rpi = 0;

xqc_cid_inner_t *inner_cid;
xqc_list_head_t *pos, *next;
Expand Down Expand Up @@ -846,7 +847,7 @@ xqc_process_new_conn_id_frame(xqc_connection_t *conn, xqc_packet_in_t *packet_in
return XQC_OK;
}

if (retire_prior_to > curr_rpi) {
if (retire_prior_to > (uint64_t)curr_rpi) {
/*
* Upon receipt of an increased Retire Prior To field, the peer MUST stop using the
* corresponding connection IDs and retire them with RETIRE_CONNECTION_ID frames before
Expand Down Expand Up @@ -918,7 +919,8 @@ xqc_int_t
xqc_process_retire_conn_id_frame(xqc_connection_t *conn, xqc_packet_in_t *packet_in)
{
xqc_int_t ret = XQC_ERROR;
uint64_t seq_num = 0, largest_scid_seq_num = 0;
uint64_t seq_num = 0;
int64_t largest_scid_seq_num = 0;

ret = xqc_parse_retire_conn_id_frame(packet_in, &seq_num);
if (ret != XQC_OK) {
Expand All @@ -939,7 +941,7 @@ xqc_process_retire_conn_id_frame(xqc_connection_t *conn, xqc_packet_in_t *packet
return -XQC_EPROTO;
}

if (seq_num > largest_scid_seq_num) {
if (seq_num > (uint64_t)largest_scid_seq_num) {
/*
* Receipt of a RETIRE_CONNECTION_ID frame containing a sequence number
* greater than any previously sent to the peer MUST be treated as a
Expand Down Expand Up @@ -1782,8 +1784,8 @@ xqc_process_mp_new_conn_id_frame(xqc_connection_t *conn, xqc_packet_in_t *packet
{
xqc_int_t ret = XQC_ERROR;
xqc_cid_t new_conn_cid;
uint64_t retire_prior_to;
int64_t curr_rpi;
uint64_t retire_prior_to = 0;
int64_t curr_rpi = 0;

xqc_cid_inner_t *inner_cid;
xqc_list_head_t *pos, *next;
Expand Down Expand Up @@ -1853,7 +1855,7 @@ xqc_process_mp_new_conn_id_frame(xqc_connection_t *conn, xqc_packet_in_t *packet
return XQC_OK;
}

if (retire_prior_to > curr_rpi) {
if (retire_prior_to > (uint64_t)curr_rpi) {
/*
* Upon receipt of an increased Retire Prior To field, the peer MUST stop using the
* corresponding connection IDs and retire them with RETIRE_CONNECTION_ID frames before
Expand Down Expand Up @@ -1927,7 +1929,8 @@ xqc_int_t
xqc_process_mp_retire_conn_id_frame(xqc_connection_t *conn, xqc_packet_in_t *packet_in)
{
xqc_int_t ret = XQC_ERROR;
uint64_t seq_num = 0, largest_scid_seq_num = 0, path_id;
uint64_t seq_num = 0, path_id;
int64_t largest_scid_seq_num = 0;

ret = xqc_parse_mp_retire_conn_id_frame(packet_in, &seq_num, &path_id);
if (ret != XQC_OK) {
Expand Down Expand Up @@ -1956,7 +1959,7 @@ xqc_process_mp_retire_conn_id_frame(xqc_connection_t *conn, xqc_packet_in_t *pac
return -XQC_EPROTO;
}

if (seq_num > largest_scid_seq_num) {
if (seq_num > (uint64_t)largest_scid_seq_num) {
/*
* Receipt of a RETIRE_CONNECTION_ID frame containing a sequence number
* greater than any previously sent to the peer MUST be treated as a
Expand Down

0 comments on commit f16e252

Please sign in to comment.