Skip to content

Commit

Permalink
[~] 修复anti_amplification_limit设小不生效的问题 (#451)
Browse files Browse the repository at this point in the history
* [~] 修复anti amplification设小不生效的问题;

* [~] 修改demo默认值为4

* [=] 合并主干版本
  • Loading branch information
Yanmei-Liu authored Sep 11, 2024
1 parent 9e82708 commit 9d3cb85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion demo/demo_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ xqc_demo_svr_init_conn_settings(xqc_engine_t *engine, xqc_demo_svr_args_t *args)
.is_interop_mode = args->quic_cfg.is_interop_mode,
.max_pkt_out_size = args->quic_cfg.max_pkt_sz,
.adaptive_ack_frequency = 1,
.anti_amplification_limit = 3,
.anti_amplification_limit = 4,
};

xqc_server_set_conn_settings(engine, &conn_settings);
Expand Down
5 changes: 3 additions & 2 deletions src/transport/xqc_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ xqc_server_set_conn_settings(xqc_engine_t *engine, const xqc_conn_settings_t *se
engine->default_conn_settings.idle_time_out = settings->idle_time_out;
}

if (settings->anti_amplification_limit > XQC_DEFAULT_ANTI_AMPLIFICATION_LIMIT) {
/* default value: 5x, it could be set to meet application need */
if (settings->anti_amplification_limit > 0) {
engine->default_conn_settings.anti_amplification_limit = settings->anti_amplification_limit;
}

Expand Down Expand Up @@ -692,7 +693,7 @@ xqc_conn_create(xqc_engine_t *engine, xqc_cid_t *dcid, xqc_cid_t *scid,
xc->conn_settings.idle_time_out = XQC_CONN_DEFAULT_IDLE_TIMEOUT;
}

if (xc->conn_settings.anti_amplification_limit < XQC_DEFAULT_ANTI_AMPLIFICATION_LIMIT) {
if (xc->conn_settings.anti_amplification_limit == 0) {
xc->conn_settings.anti_amplification_limit = XQC_DEFAULT_ANTI_AMPLIFICATION_LIMIT;
}

Expand Down

0 comments on commit 9d3cb85

Please sign in to comment.