Skip to content

Commit 3607442

Browse files
authored
[!] fix bugs and building error on ubuntu and macOS, add initial rtt (#407)
[-] deprecate XQC_NO_PID_PACKET_PROCESS; [=] optimize connection transport parameters; [!] fix CC frame packet error; [+] add initial_rtt; [!] fix loss, retransmission, and spurious loss counting; [!] optimize 0-RTT sending; [!] add protection for zero-length header value; [=] reduce http3 body read notify; [!] retransmit PING frame sent by app layer; [!] fix building boringssl on ubuntu and macOS;
1 parent f3cab88 commit 3607442

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+478
-334
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ if(PLATFORM MATCHES "mac")
359359
${SSL_LIB_PATH}
360360
"-Wl"
361361
-lpthread
362+
-lstdc++
362363
)
363364
else()
364365
target_link_libraries(

demo/demo_client.c

+14-13
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ typedef struct xqc_demo_cli_quic_config_s {
190190

191191
size_t max_pkt_sz;
192192

193+
char co_str[XQC_CO_STR_MAX_LEN];
194+
193195
} xqc_demo_cli_quic_config_t;
194196

195197

@@ -1265,9 +1267,9 @@ xqc_demo_cli_h3_request_close_notify(xqc_h3_request_t *h3_request, void *user_da
12651267
xqc_request_stats_t stats;
12661268
stats = xqc_h3_request_get_stats(h3_request);
12671269
printf("send_body_size:%zu, recv_body_size:%zu, send_header_size:%zu, recv_header_size:%zu, "
1268-
"recv_fin:%d, err:%d, rate_limit:%"PRIu64", mp_state:%d, avail_send_weight:%.3lf, avail_recv_weight:%.3lf\n",
1270+
"recv_fin:%d, err:%d, rate_limit:%"PRIu64", mp_state:%d, early_data:%d, avail_send_weight:%.3lf, avail_recv_weight:%.3lf\n",
12691271
stats.send_body_size, stats.recv_body_size, stats.send_header_size, stats.recv_header_size,
1270-
user_stream->recv_fin, stats.stream_err, stats.rate_limit, stats.mp_state,
1272+
user_stream->recv_fin, stats.stream_err, stats.rate_limit, stats.mp_state, stats.early_data_state,
12711273
stats.mp_default_path_send_weight, stats.mp_default_path_recv_weight);
12721274

12731275
printf("\033[33m[H3-req] send_bytes:%zu, recv_bytes:%zu, path_info:%s\n\033[0m",
@@ -1337,19 +1339,11 @@ xqc_demo_cli_socket_read_handler(xqc_demo_cli_user_conn_t *user_conn, int fd)
13371339
recv_sum += recv_size;
13381340
uint64_t recv_time = xqc_now();
13391341
user_path->last_sock_op_time = recv_time;
1340-
#ifdef XQC_NO_PID_PACKET_PROCESS
13411342
if (xqc_engine_packet_process(user_conn->ctx->engine, packet_buf, recv_size,
13421343
(struct sockaddr *)(&user_path->local_addr),
13431344
user_path->local_addrlen, (struct sockaddr *)(&addr),
13441345
addr_len, (xqc_msec_t)recv_time,
13451346
user_conn) != XQC_OK)
1346-
#else
1347-
if (xqc_engine_packet_process(user_conn->ctx->engine, packet_buf, recv_size,
1348-
(struct sockaddr *)(&user_path->local_addr),
1349-
user_path->local_addrlen, (struct sockaddr *)(&addr),
1350-
addr_len, user_path->path_id, (xqc_msec_t)recv_time,
1351-
user_conn) != XQC_OK)
1352-
#endif
13531347
{
13541348
return;
13551349
}
@@ -1630,7 +1624,7 @@ xqc_demo_cli_init_conneciton_settings(xqc_conn_settings_t* settings,
16301624
settings->pacing_on = args->net_cfg.pacing;
16311625
settings->cong_ctrl_callback = cong_ctrl;
16321626
settings->cc_params.customize_on = 1,
1633-
settings->cc_params.init_cwnd = 32,
1627+
settings->cc_params.init_cwnd = 96,
16341628
settings->so_sndbuf = 1024*1024;
16351629
settings->proto_version = XQC_VERSION_V1;
16361630
settings->spurious_loss_detect_on = 1;
@@ -1651,6 +1645,7 @@ xqc_demo_cli_init_conneciton_settings(xqc_conn_settings_t* settings,
16511645
settings->enable_stream_rate_limit = 1;
16521646
settings->recv_rate_bytes_per_sec = 0;
16531647
}
1648+
strncpy(settings->conn_option_str, args->quic_cfg.co_str, XQC_CO_STR_MAX_LEN);
16541649
}
16551650

16561651
/* set client args to default values */
@@ -1797,14 +1792,15 @@ xqc_demo_cli_usage(int argc, char *argv[])
17971792
" -e NAT rebinding on path 0\n"
17981793
" -E NAT rebinding on path 1\n"
17991794
" -F MTU size (default: 1200)\n"
1795+
" -G Google connection options (e.g. CBBR,TBBR)\n"
18001796
, prog);
18011797
}
18021798

18031799
void
18041800
xqc_demo_cli_parse_args(int argc, char *argv[], xqc_demo_cli_client_args_t *args)
18051801
{
18061802
int ch = 0;
1807-
while ((ch = getopt(argc, argv, "a:p:c:Ct:S:0m:A:D:l:L:k:K:U:u:dMoi:w:Ps:bZ:NQT:R:V:B:I:n:eEF:")) != -1) {
1803+
while ((ch = getopt(argc, argv, "a:p:c:Ct:S:0m:A:D:l:L:k:K:U:u:dMoi:w:Ps:bZ:NQT:R:V:B:I:n:eEF:G:")) != -1) {
18081804
switch (ch) {
18091805
/* server ip */
18101806
case 'a':
@@ -2043,6 +2039,11 @@ xqc_demo_cli_parse_args(int argc, char *argv[], xqc_demo_cli_client_args_t *args
20432039
printf("MTU size: %s\n", optarg);
20442040
args->quic_cfg.max_pkt_sz = atoi(optarg);
20452041
break;
2042+
2043+
case 'G':
2044+
printf("Google connection options: %s\n", optarg);
2045+
strncpy(args->quic_cfg.co_str, optarg, XQC_CO_STR_MAX_LEN);
2046+
break;
20462047

20472048
default:
20482049
printf("other option :%c\n", ch);
@@ -2266,7 +2267,7 @@ xqc_demo_cli_h3_conn_close_notify(xqc_h3_conn_t *h3_conn, const xqc_cid_t *cid,
22662267
xqc_demo_cli_user_conn_t *user_conn = (xqc_demo_cli_user_conn_t *)user_data;
22672268
xqc_conn_stats_t stats = xqc_conn_get_stats(user_conn->ctx->engine, cid);
22682269
printf("send_count:%u, lost_count:%u, tlp_count:%u, recv_count:%u, srtt:%"PRIu64" "
2269-
"early_data_flag:%d, conn_err:%d, ack_info:%s conn_info:%s\n", stats.send_count, stats.lost_count,
2270+
"early_data_flag:%d, conn_err:%d, ack_info:%s, conn_info:%s\n", stats.send_count, stats.lost_count,
22702271
stats.tlp_count, stats.recv_count, stats.srtt, stats.early_data_flag, stats.conn_err,
22712272
stats.ack_info, stats.conn_info);
22722273

demo/demo_server.c

-7
Original file line numberDiff line numberDiff line change
@@ -1052,17 +1052,10 @@ xqc_demo_svr_socket_read_handler(xqc_demo_svr_ctx_t *ctx, int fd)
10521052
recv_sum += recv_size;
10531053

10541054
uint64_t recv_time = xqc_now();
1055-
#ifdef XQC_NO_PID_PACKET_PROCESS
10561055
xqc_int_t ret = xqc_engine_packet_process(ctx->engine, packet_buf, recv_size,
10571056
(struct sockaddr *)(&ctx->local_addr), ctx->local_addrlen,
10581057
(struct sockaddr *)(&peer_addr), peer_addrlen,
10591058
(xqc_usec_t)recv_time, ctx);
1060-
#else
1061-
xqc_int_t ret = xqc_engine_packet_process(ctx->engine, packet_buf, recv_size,
1062-
(struct sockaddr *)(&ctx->local_addr), ctx->local_addrlen,
1063-
(struct sockaddr *)(&peer_addr), peer_addrlen, XQC_UNKNOWN_PATH_ID,
1064-
(xqc_usec_t)recv_time, ctx);
1065-
#endif
10661059
if (ret != XQC_OK) {
10671060
printf("server_read_handler: packet process err, ret: %d\n", ret);
10681061
return;

include/xquic/xqc_http3.h

+8
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ typedef struct xqc_request_stats_s {
156156

157157
uint64_t rate_limit;
158158

159+
/**
160+
* @brief 0RTT state
161+
* 0: no 0RTT
162+
* 1: 0RTT accept
163+
* 2: 0RTT reject
164+
*/
165+
uint8_t early_data_state;
166+
159167
char stream_info[XQC_STREAM_INFO_LEN];
160168
} xqc_request_stats_t;
161169

include/xquic/xquic.h

+28-15
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ typedef enum xqc_proto_version_s {
7171

7272
#define XQC_DGRAM_RETX_ASKED_BY_APP 1
7373

74+
#define XQC_CO_MAX_NUM 16
75+
#define XQC_CO_STR_MAX_LEN (5 * XQC_CO_MAX_NUM)
76+
7477

7578
/**
7679
* @brief get timestamp callback function. this might be useful on different platforms
@@ -1263,6 +1266,19 @@ typedef struct xqc_conn_settings_s {
12631266
uint8_t protect_pool_mem;
12641267
#endif
12651268

1269+
char conn_option_str[XQC_CO_STR_MAX_LEN];
1270+
1271+
/**
1272+
* @brief intial_rtt (us). Default: 0 (use the internal default value -- 250000)
1273+
*
1274+
*/
1275+
xqc_usec_t initial_rtt;
1276+
/**
1277+
* @brief initial pto duration (us). Default: 0 (use the internal default value -- 3xinitial_rtt)
1278+
*
1279+
*/
1280+
xqc_usec_t initial_pto_duration;
1281+
12661282
} xqc_conn_settings_t;
12671283

12681284

@@ -1335,6 +1351,11 @@ typedef struct xqc_conn_stats_s {
13351351
char alpn[XQC_MAX_ALPN_BUF_LEN];
13361352
} xqc_conn_stats_t;
13371353

1354+
typedef struct xqc_conn_qos_stats_s {
1355+
xqc_usec_t srtt; /* smoothed SRTT at present: initial value = 250000 */
1356+
xqc_usec_t min_rtt; /* minimum RTT until now: initial value = 0xFFFFFFFF */
1357+
uint64_t inflight_bytes; /* initial value = 0 */
1358+
} xqc_conn_qos_stats_t;
13381359

13391360
/*************************************************************
13401361
* engine layer APIs
@@ -1400,29 +1421,14 @@ xqc_int_t xqc_engine_unregister_alpn(xqc_engine_t *engine, const char *alpn, siz
14001421
* Pass received UDP packet payload into xquic engine.
14011422
* @param recv_time UDP packet received time in microsecond
14021423
* @param user_data connection user_data, server is NULL
1403-
* @param path_id XQC_UNKNOWN_PATH_ID = unknown path (only use cid to identify the path)
14041424
*/
1405-
1406-
#ifdef XQC_NO_PID_PACKET_PROCESS
1407-
14081425
XQC_EXPORT_PUBLIC_API
14091426
xqc_int_t xqc_engine_packet_process(xqc_engine_t *engine,
14101427
const unsigned char *packet_in_buf, size_t packet_in_size,
14111428
const struct sockaddr *local_addr, socklen_t local_addrlen,
14121429
const struct sockaddr *peer_addr, socklen_t peer_addrlen,
14131430
xqc_usec_t recv_time, void *user_data);
14141431

1415-
#else
1416-
1417-
XQC_EXPORT_PUBLIC_API
1418-
xqc_int_t xqc_engine_packet_process(xqc_engine_t *engine,
1419-
const unsigned char *packet_in_buf, size_t packet_in_size,
1420-
const struct sockaddr *local_addr, socklen_t local_addrlen,
1421-
const struct sockaddr *peer_addr, socklen_t peer_addrlen,
1422-
uint64_t path_id, xqc_usec_t recv_time, void *user_data);
1423-
1424-
#endif
1425-
14261432

14271433
/**
14281434
* @brief Process all connections, application implements MUST call this function in timer callback
@@ -1817,6 +1823,13 @@ void xqc_conn_continue_send_by_conn(xqc_connection_t *conn);
18171823
XQC_EXPORT_PUBLIC_API
18181824
xqc_conn_stats_t xqc_conn_get_stats(xqc_engine_t *engine, const xqc_cid_t *cid);
18191825

1826+
1827+
/**
1828+
* User can get xqc_conn_qos_stats_t by cid
1829+
*/
1830+
XQC_EXPORT_PUBLIC_API
1831+
xqc_conn_qos_stats_t xqc_conn_get_qos_stats(xqc_engine_t *engine, const xqc_cid_t *cid);
1832+
18201833
/**
18211834
* create new path for client
18221835
* @param cid scid for connection

include/xquic/xquic_typedef.h

+58
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ typedef struct xqc_path_ctx_s xqc_path_ctx_t;
9494
typedef struct xqc_timer_manager_s xqc_timer_manager_t;
9595
typedef struct xqc_h3_ext_bytestream_s xqc_h3_ext_bytestream_t;
9696
typedef struct xqc_ping_record_s xqc_ping_record_t;
97+
typedef struct xqc_conn_qos_stats_s xqc_conn_qos_stats_t;
9798

9899
typedef uint64_t xqc_msec_t; /* store millisecond values */
99100
typedef uint64_t xqc_usec_t; /* store microsecond values */
@@ -221,4 +222,61 @@ typedef struct xqc_stream_settings_s {
221222
uint64_t recv_rate_bytes_per_sec;
222223
} xqc_stream_settings_t;
223224

225+
#define XQC_CO_TAG(a, b, c, d) (uint32_t)((a << 24) + (b << 16) + (c << 8) + d)
226+
227+
typedef enum xqc_conn_option_e {
228+
XQC_CO_TBBR = XQC_CO_TAG('T', 'B', 'B', 'R'), // Reduced Buffer Bloat TCP
229+
XQC_CO_1RTT = XQC_CO_TAG('1', 'R', 'T', 'T'), // STARTUP in BBR for 1 RTT
230+
XQC_CO_2RTT = XQC_CO_TAG('2', 'R', 'T', 'T'), // STARTUP in BBR for 2 RTTs
231+
XQC_CO_BBR4 = XQC_CO_TAG('B', 'B', 'R', '4'), // 20 RTT ack aggregation
232+
XQC_CO_BBR5 = XQC_CO_TAG('B', 'B', 'R', '5'), // 40 RTT ack aggregation
233+
XQC_CO_IW03 = XQC_CO_TAG('I', 'W', '0', '3'), // Force ICWND to 3
234+
XQC_CO_IW10 = XQC_CO_TAG('I', 'W', '1', '0'), // Force ICWND to 10
235+
XQC_CO_IW20 = XQC_CO_TAG('I', 'W', '2', '0'), // Force ICWND to 20
236+
XQC_CO_IW50 = XQC_CO_TAG('I', 'W', '5', '0'), // Force ICWND to 50
237+
XQC_CO_B2ON = XQC_CO_TAG('B', '2', 'O', 'N'), // Enable BBRv2
238+
XQC_CO_COPA = XQC_CO_TAG('C', 'O', 'P', 'A'), // Enable COPA
239+
XQC_CO_C2ON = XQC_CO_TAG('C', '2', 'O', 'N'), // Enable CopaV2
240+
XQC_CO_QBIC = XQC_CO_TAG('Q', 'B', 'I', 'C'), // TCP Cubic
241+
XQC_CO_RENO = XQC_CO_TAG('R', 'E', 'N', 'O'), // Enable reno
242+
XQC_CO_SPRI = XQC_CO_TAG('S', 'P', 'R', 'I'), // enable stream priority by streamid
243+
XQC_CO_9218 = XQC_CO_TAG('9', '2', '1', '8'), // enable stream priority by rfc9218
244+
XQC_CO_D218 = XQC_CO_TAG('D', '2', '1', '8'), // disable rfc9218
245+
XQC_CO_DRST = XQC_CO_TAG('D', 'R', 'S', 'T'), // disable cease sending stream
246+
XQC_CO_CBBR = XQC_CO_TAG('C', 'B', 'B', 'R'), // A global option to enable all the following options (Customized BBR)
247+
XQC_CO_BNLS = XQC_CO_TAG('B', 'N', 'L', 'S'), // Force BBR not to respond on losses during STARTUP
248+
XQC_CO_BACG = XQC_CO_TAG('B', 'A', 'C', 'G'), // Use Adaptive CWND_GAIN in BBR
249+
XQC_CO_CG03 = XQC_CO_TAG('C', 'G', '0', '3'), // Use 3 for CWND_GAIN in BBR
250+
XQC_CO_CG05 = XQC_CO_TAG('C', 'G', '0', '5'), // Use 5 for CWND_GAIN in BBR
251+
XQC_CO_CG10 = XQC_CO_TAG('C', 'G', '1', '0'), // Use 10 for CWND_GAIN in BBR
252+
XQC_CO_CG20 = XQC_CO_TAG('C', 'G', '2', '0'), // Use 20 for CWND_GAIN in BBR
253+
XQC_CO_PG11 = XQC_CO_TAG('P', 'G', '1', '1'), // Use 1.1 for PACING_GAIN in BBR PROBE_UP
254+
XQC_CO_PG15 = XQC_CO_TAG('P', 'G', '1', '5'), // Use 1.5 for PACING_GAIN in BBR PROBE_UP
255+
XQC_CO_BNLR = XQC_CO_TAG('B', 'N', 'L', 'R'), // Disable BBR's loss recovery state
256+
XQC_CO_MW10 = XQC_CO_TAG('M', 'W', '1', '0'), // Set min CWND to 10
257+
XQC_CO_MW20 = XQC_CO_TAG('M', 'W', '2', '0'), // Set min CWND to 20
258+
XQC_CO_MW32 = XQC_CO_TAG('M', 'W', '3', '2'), // Set min CWND to 32
259+
XQC_CO_MW50 = XQC_CO_TAG('M', 'W', '5', '0'), // Set min CWND to 50
260+
XQC_CO_WL20 = XQC_CO_TAG('W', 'L', '2', '0'), // Set BW window length to 20 (RTTs)
261+
XQC_CO_WL30 = XQC_CO_TAG('W', 'L', '3', '0'), // Set BW window length to 30 (RTTs)
262+
XQC_CO_WL40 = XQC_CO_TAG('W', 'L', '4', '0'), // Set BW window length to 40 (RTTs)
263+
XQC_CO_WL50 = XQC_CO_TAG('W', 'L', '5', '0'), // Set BW window length to 50 (RTTs)
264+
XQC_CO_PR02 = XQC_CO_TAG('P', 'R', '0', '2'), // Set the target CWND in ProbeRTT to 0.2xBDP
265+
XQC_CO_PR03 = XQC_CO_TAG('P', 'R', '0', '3'), // Set the target CWND in ProbeRTT to 0.3xBDP
266+
XQC_CO_PR04 = XQC_CO_TAG('P', 'R', '0', '4'), // Set the target CWND in ProbeRTT to 0.4xBDP
267+
XQC_CO_PR05 = XQC_CO_TAG('P', 'R', '0', '5'), // Set the target CWND in ProbeRTT to 0.5xBDP
268+
XQC_CO_PR06 = XQC_CO_TAG('P', 'R', '0', '6'), // Set the target CWND in ProbeRTT to 0.6xBDP
269+
XQC_CO_PR07 = XQC_CO_TAG('P', 'R', '0', '7'), // Set the target CWND in ProbeRTT to 0.7xBDP
270+
XQC_CO_ENWC = XQC_CO_TAG('E', 'N', 'W', 'C'), // Enable CWND compensation according to jitter
271+
XQC_CO_JW10 = XQC_CO_TAG('J', 'W', '1', '0'), // Set the window length of max jitter filter to 10xRTT (default)
272+
XQC_CO_JW20 = XQC_CO_TAG('J', 'W', '2', '0'), // Set the window length of max jitter filter to 20xRTT
273+
XQC_CO_JW30 = XQC_CO_TAG('J', 'W', '3', '0'), // Set the window length of max jitter filter to 30xRTT
274+
XQC_CO_JW40 = XQC_CO_TAG('J', 'W', '4', '0'), // Set the window length of max jitter filter to 40xRTT
275+
XQC_CO_JW50 = XQC_CO_TAG('J', 'W', '5', '0'), // Set the window length of max jitter filter to 50xRTT
276+
XQC_CO_SL03 = XQC_CO_TAG('S', 'L', '0', '3'), // Set the STARTUP loss rate threshold to 0.03
277+
XQC_CO_SL04 = XQC_CO_TAG('S', 'L', '0', '4'), // Set the STARTUP loss rate threshold to 0.04
278+
XQC_CO_SL05 = XQC_CO_TAG('S', 'L', '0', '5'), // Set the STARTUP loss rate threshold to 0.05
279+
XQC_CO_SL10 = XQC_CO_TAG('S', 'L', '1', '0'), // Set the STARTUP loss rate threshold to 0.05
280+
} xqc_conn_option_t;
281+
224282
#endif /*_XQUIC_TYPEDEF_H_INCLUDED_*/

scripts/case_test.sh

+19-7
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,22 @@ fi
723723
grep_err_log
724724

725725

726+
clear_log
727+
echo -e "empty header value ...\c"
728+
${CLIENT_BIN} -x 47 -1 -n 10 >> stdlog
729+
result=`grep -E "test_result_speed:.*request_cnt: 10." stdlog`
730+
errlog=`grep_err_log`
731+
if [ -n "$result" ] && [ -z "$errlog" ]; then
732+
echo ">>>>>>>> pass:1"
733+
case_print_result "empty_header_value" "pass"
734+
else
735+
echo ">>>>>>>> pass:0"
736+
case_print_result "empty_header_value" "fail"
737+
exit 1
738+
fi
739+
grep_err_log
740+
741+
726742
clear_log
727743
rm -f test_session
728744
echo -e "NULL stream callback ...\c"
@@ -819,7 +835,7 @@ grep_err_log|grep -v xqc_h3_stream_send_headers
819835

820836
clear_log
821837
echo -e "send 1K data ...\c"
822-
result=`${CLIENT_BIN} -s 1024 -l d -t 1 -E|grep ">>>>>>>> pass"`
838+
result=`${CLIENT_BIN} -s 1024 -l d -t 1 -E --conn_options CBBR|grep ">>>>>>>> pass"`
823839
errlog=`grep_err_log`
824840
echo "$result"
825841
if [ -z "$errlog" ] && [ "$result" == ">>>>>>>> pass:1" ]; then
@@ -4126,13 +4142,11 @@ rm -rf tp_localhost test_session xqc_token
41264142
clear_log
41274143
echo -e "freeze path0 ...\c"
41284144
sudo ${CLIENT_BIN} -s 1024000 -l d -E -e 4 -T 2 --epoch_timeout 2000000 -t 4 -M -i lo -i lo -x 107 > stdlog
4129-
stream_info3=`grep "stream_info:" stdlog | head -n 3 | tail -n 1 | grep -v "#0" | grep "#1"`
4130-
stream_info5=`grep "stream_info:" stdlog | tail -n 1 | grep -E "#0.*#1"`
41314145
clog_res1=`grep -E "path:0.*app_path_status:2->3" clog`
41324146
clog_res2=`grep -E "path:0.*app_path_status:3->1" clog`
41334147
slog_res1=`grep -E "path:0.*app_path_status:2->3" slog`
41344148
slog_res2=`grep -E "path:0.*app_path_status:3->1" slog`
4135-
if [ -n "$stream_info3" ] && [ -n "$stream_info5" ] && [ -n "$clog_res1" ] && [ -n "$clog_res2" ] && [ -n "$slog_res1" ] && [ -n "$slog_res2" ] ; then
4149+
if [ -n "$clog_res1" ] && [ -n "$clog_res2" ] && [ -n "$slog_res1" ] && [ -n "$slog_res2" ] ; then
41364150
echo ">>>>>>>> pass:1"
41374151
case_print_result "freeze_path0" "pass"
41384152
else
@@ -4144,13 +4158,11 @@ rm -rf tp_localhost test_session xqc_token
41444158
clear_log
41454159
echo -e "freeze path1 ...\c"
41464160
sudo ${CLIENT_BIN} -s 1024000 -l d -E -e 4 -T 2 --epoch_timeout 2000000 -t 4 -M -i lo -i lo -x 108 > stdlog
4147-
stream_info3=`grep "stream_info:" stdlog | head -n 3 | tail -n 1 | grep -v "#1" | grep "#0"`
4148-
stream_info5=`grep "stream_info:" stdlog | tail -n 1 | grep -E "#0.*#1"`
41494161
clog_res1=`grep -E "path:1.*app_path_status:2->3" clog`
41504162
clog_res2=`grep -E "path:1.*app_path_status:3->1" clog`
41514163
slog_res1=`grep -E "path:1.*app_path_status:2->3" slog`
41524164
slog_res2=`grep -E "path:1.*app_path_status:3->1" slog`
4153-
if [ -n "$stream_info3" ] && [ -n "$stream_info5" ] && [ -n "$clog_res1" ] && [ -n "$clog_res2" ] && [ -n "$slog_res1" ] && [ -n "$slog_res2" ] ; then
4165+
if [ -n "$clog_res1" ] && [ -n "$clog_res2" ] && [ -n "$slog_res1" ] && [ -n "$slog_res2" ] ; then
41544166
echo ">>>>>>>> pass:1"
41554167
case_print_result "freeze_path1" "pass"
41564168
else

src/common/utils/ringmem/xqc_ring_mem.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ xqc_ring_mem_undo(xqc_ring_mem_t *rmem, xqc_ring_mem_idx_t idx, size_t len)
267267
int
268268
xqc_ring_mem_cmp(xqc_ring_mem_t *rmem, xqc_ring_mem_idx_t idx, uint8_t *data, size_t len)
269269
{
270-
if (idx < rmem->sidx || idx + len > rmem->eidx) {
270+
if (idx < rmem->sidx || idx + len > rmem->eidx || len == 0) {
271271
return -XQC_EPARAM;
272272
}
273273

src/common/xqc_algorithm.h

+12
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,16 @@ xqc_uint32_list_find(const uint32_t *list, size_t count, uint32_t target)
2020
return -1;
2121
}
2222

23+
static inline uint64_t
24+
xqc_uint64_bounded_subtract(uint64_t a, uint64_t b)
25+
{
26+
return a > b ? a - b : 0;
27+
}
28+
29+
static inline uint32_t
30+
xqc_uint32_bounded_subtract(uint32_t a, uint32_t b)
31+
{
32+
return a > b ? a - b : 0;
33+
}
34+
2335
#endif /* XQC_ALGORITHM_H_INCLUDED */

src/common/xqc_str.h

+11
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,16 @@ xqc_memeq(const void *s1, const void *s2, size_t n)
9595
return n == 0 || memcmp(s1, s2, n) == 0;
9696
}
9797

98+
inline static xqc_bool_t
99+
xqc_char_is_letter_or_number(char c)
100+
{
101+
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')
102+
|| (c >= '0' && c <= '9'))
103+
{
104+
return XQC_TRUE;
105+
}
106+
return XQC_FALSE;
107+
}
108+
98109

99110
#endif /*_XQC_STR_H_INCLUDED_*/

0 commit comments

Comments
 (0)