From ddb41ce22f506114eb702fcb132178602d773591 Mon Sep 17 00:00:00 2001 From: luwenpeng Date: Tue, 27 Feb 2024 11:18:21 +0800 Subject: [PATCH] =?UTF-8?q?TSG-19591=20TCP=20Proxy=20Profiles=E4=B8=AD?= =?UTF-8?q?=E7=9A=84User=20Timeout=E9=85=8D=E7=BD=AE=E9=A1=B9=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=90=AF=E7=94=A8=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/business/tcp-policy/src/tcp_policy.cpp | 20 ++++++++++++++++--- resource/pangu/pangu_http.json | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/plugin/business/tcp-policy/src/tcp_policy.cpp b/plugin/business/tcp-policy/src/tcp_policy.cpp index a7d352d..d5360b0 100644 --- a/plugin/business/tcp-policy/src/tcp_policy.cpp +++ b/plugin/business/tcp-policy/src/tcp_policy.cpp @@ -102,10 +102,24 @@ static int parser_side_conn_param(const char *json_str, struct side_conn_param * out_val->ttl = item->valueint; } - item = cJSON_GetObjectItem(json, "user_timeout"); - if (item && item->type == cJSON_Number) + object = cJSON_GetObjectItem(json, "user_timeout"); + if (object) { - out_val->user_timeout = item->valueint; + int enable = 0; + item = cJSON_GetObjectItem(object, "enable"); + if (item && item->type == cJSON_Number) + { + enable = item->valueint; + } + item = cJSON_GetObjectItem(object, "timeout_ms"); + if (item && item->type == cJSON_Number) + { + out_val->user_timeout = item->valueint; + } + if (enable == 0) + { + out_val->user_timeout = 0; + } } cJSON_Delete(json); diff --git a/resource/pangu/pangu_http.json b/resource/pangu/pangu_http.json index 663344b..1517855 100644 --- a/resource/pangu/pangu_http.json +++ b/resource/pangu/pangu_http.json @@ -269,7 +269,7 @@ { "table_name": "PXY_PROFILE_TCP_OPTION", "table_content": [ - "1\t0\t0\t{\"tcp_maxseg\":{\"enable\":0,\"maxseg\":1500},\"nodelay\":1,\"keep_alive\":{\"enable\":1,\"tcp_keepcnt\":8,\"tcp_keepidle\":30,\"tcp_keepintvl\":15},\"ttl\":70,\"user_timeout\":600}\t{\"tcp_maxseg\":{\"enable\":0,\"maxseg\":1500},\"nodelay\":1,\"keep_alive\":{\"enable\":1,\"tcp_keepcnt\":8,\"tcp_keepidle\":30,\"tcp_keepintvl\":15},\"ttl\":75,\"user_timeout\":600}\t1" + "1\t0\t0\t{\"tcp_maxseg\":{\"enable\":0,\"maxseg\":1500},\"nodelay\":1,\"keep_alive\":{\"enable\":1,\"tcp_keepcnt\":8,\"tcp_keepidle\":30,\"tcp_keepintvl\":15},\"ttl\":70,\"user_timeout\":{\"enable\":1,\"timeout_ms\":600}}\t{\"tcp_maxseg\":{\"enable\":0,\"maxseg\":1500},\"nodelay\":1,\"keep_alive\":{\"enable\":1,\"tcp_keepcnt\":8,\"tcp_keepidle\":30,\"tcp_keepintvl\":15},\"ttl\":75,\"user_timeout\":{\"enable\":1,\"timeout_ms\":600}}\t1" ] }, {