From f3cab8816d4a68227df298df0cf9da90b18aae52 Mon Sep 17 00:00:00 2001 From: Wu Zhao Date: Tue, 16 Jan 2024 17:09:19 +0800 Subject: [PATCH] [!] fix crash on ubuntu 32 (#397) --- demo/demo_server.c | 2 +- src/common/xqc_log_event_callback.c | 25 +++++++++++++------------ src/transport/xqc_send_ctl.c | 2 +- src/transport/xqc_send_queue.c | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/demo/demo_server.c b/demo/demo_server.c index 3f9c7e82e..17f51af63 100644 --- a/demo/demo_server.c +++ b/demo/demo_server.c @@ -1474,7 +1474,7 @@ xqc_demo_svr_init_conn_settings(xqc_demo_svr_args_t *args) break; } - xqc_scheduler_callback_t sched; + xqc_scheduler_callback_t sched = {0}; if (strncmp(args->quic_cfg.mp_sched, "minrtt", strlen("minrtt")) == 0) { sched = xqc_minrtt_scheduler_cb; diff --git a/src/common/xqc_log_event_callback.c b/src/common/xqc_log_event_callback.c index 66af99906..b5e9a0ee7 100644 --- a/src/common/xqc_log_event_callback.c +++ b/src/common/xqc_log_event_callback.c @@ -140,7 +140,7 @@ void xqc_log_TRA_PACKET_RECEIVED_callback(xqc_log_t *log, const char *func, xqc_packet_in_t *packet_in) { xqc_log_implement(log, TRA_PACKET_RECEIVED, func, - "|pkt_pns:%d|pkt_type:%d|pkt_num:%d|len:%d|frame_flag:%s|", + "|pkt_pns:%d|pkt_type:%d|pkt_num:%ui|len:%uz|frame_flag:%s|", packet_in->pi_pkt.pkt_pns, packet_in->pi_pkt.pkt_type, packet_in->pi_pkt.pkt_num, packet_in->buf_size, xqc_frame_type_2_str(packet_in->pi_frame_types)); } @@ -149,7 +149,7 @@ void xqc_log_TRA_PACKET_SENT_callback(xqc_log_t *log, const char *func, xqc_packet_out_t *packet_out) { xqc_log_implement(log, TRA_PACKET_SENT, func, - "|pkt_pns:%d|pkt_type:%d|pkt_num:%d|size:%d|frame_flag:%s|", + "|pkt_pns:%d|pkt_type:%d|pkt_num:%ui|size:%d|frame_flag:%s|", packet_out->po_pkt.pkt_pns, packet_out->po_pkt.pkt_type, packet_out->po_pkt.pkt_num, packet_out->po_used_size, xqc_frame_type_2_str(packet_out->po_frame_types)); } @@ -175,7 +175,7 @@ void xqc_log_TRA_DATAGRAMS_SENT_callback(xqc_log_t *log, const char *func, ssize_t size) { xqc_log_implement(log, TRA_DATAGRAMS_SENT, func, - "|size:%d|", size); + "|size:%z|", size); } void @@ -671,20 +671,21 @@ xqc_log_QPACK_INSTRUCTION_CREATED_callback(xqc_log_t *log, const char *func, ... break; } case XQC_INS_TYPE_ENC_INSERT_NAME_REF: { - xqc_int_t table_type = va_arg(args, xqc_int_t); - uint64_t name_index = va_arg(args, uint64_t); - uint64_t value_len = va_arg(args, uint64_t); - char *value = va_arg(args, char *); + xqc_flag_t table_type = va_arg(args, xqc_flag_t); + uint64_t name_index = va_arg(args, uint64_t); + size_t value_len = va_arg(args, size_t); + char *value = va_arg(args, char *); xqc_log_implement(log, QPACK_INSTRUCTION_CREATED, func, "|insert_with_name_reference|%s|name_index:%ui|value:%*s|", - table_type == XQC_DTABLE_FLAG ? "dtable" : "stable", name_index, (size_t) value_len, value); + table_type == XQC_DTABLE_FLAG ? "dtable" : "stable", + name_index, (size_t) value_len, value); break; } case XQC_INS_TYPE_ENC_INSERT_LITERAL: { - uint64_t name_len = va_arg(args, uint64_t); - char *name = va_arg(args, char *); - uint64_t value_len = va_arg(args, uint64_t); - char *value = va_arg(args, char *); + size_t name_len = va_arg(args, size_t); + char *name = va_arg(args, char *); + size_t value_len = va_arg(args, size_t); + char *value = va_arg(args, char *); xqc_log_implement(log, QPACK_INSTRUCTION_CREATED, func, "|insert_without_name_reference|name:%*s|value:%*s|", (size_t) name_len, name, (size_t) value_len, value); diff --git a/src/transport/xqc_send_ctl.c b/src/transport/xqc_send_ctl.c index ddfd8fa99..45eddcaf3 100644 --- a/src/transport/xqc_send_ctl.c +++ b/src/transport/xqc_send_ctl.c @@ -871,7 +871,7 @@ xqc_send_ctl_on_ack_received(xqc_send_ctl_t *send_ctl, xqc_pn_ctl_t *pn_ctl, xqc xqc_log(conn->log, XQC_LOG_DEBUG, "|conn:%p|path:%ui|pkt_num:%ui|origin_pktnum:%ui|size:%ud|pns:%d|pkt_type:%s|frame:%s|conn_state:%s|frame_largest_ack:%ui|path_largest_ack:%ui|", conn, send_ctl->ctl_path->path_id, packet_out->po_pkt.pkt_num, - (xqc_packet_number_t)packet_out->po_origin ? packet_out->po_origin->po_pkt.pkt_num : 0, + (xqc_packet_number_t)(packet_out->po_origin ? packet_out->po_origin->po_pkt.pkt_num : 0), packet_out->po_used_size, pns, xqc_pkt_type_2_str(packet_out->po_pkt.pkt_type), xqc_frame_type_2_str(packet_out->po_frame_types), diff --git a/src/transport/xqc_send_queue.c b/src/transport/xqc_send_queue.c index b289777f4..9cdbc3bc9 100644 --- a/src/transport/xqc_send_queue.c +++ b/src/transport/xqc_send_queue.c @@ -528,7 +528,7 @@ xqc_send_queue_drop_packets_with_type(xqc_send_ctl_t *send_ctl, xqc_send_queue_t xqc_send_queue_insert_free(packet_out, &send_queue->sndq_free_packets, send_queue); - xqc_log(send_ctl->ctl_conn->log, XQC_LOG_DEBUG, "|drop pkt from unacked|inflight:%ui|cwnd:%ui|" + xqc_log(send_ctl->ctl_conn->log, XQC_LOG_DEBUG, "|drop pkt from unacked|inflight:%ud|cwnd:%ui|" "pkt_num:%ui|ptype:%d|frames:%s|", send_ctl->ctl_bytes_in_flight, send_ctl->ctl_cong_callback->xqc_cong_ctl_get_cwnd(send_ctl->ctl_cong), packet_out->po_pkt.pkt_num, packet_out->po_pkt.pkt_type, xqc_frame_type_2_str(packet_out->po_frame_types));