summaryrefslogtreecommitdiff
path: root/plugin/business/tsg-http/src/tsg_logger.cpp
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2023-08-02 16:55:56 +0800
committerfengweihao <[email protected]>2023-08-02 16:55:56 +0800
commite43b4954b5b75ef5dd27974073b691a68bdbf9f7 (patch)
treeaa9c528b504f87414fd428cdbb895a070b5df270 /plugin/business/tsg-http/src/tsg_logger.cpp
parent2451bd795c801ac4bf961a28978fdf8a34dfcbfc (diff)
TSG-16126 修复Proxy Events日志中存在c2s和s2c有字节数为0的问题
Diffstat (limited to 'plugin/business/tsg-http/src/tsg_logger.cpp')
-rw-r--r--plugin/business/tsg-http/src/tsg_logger.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/plugin/business/tsg-http/src/tsg_logger.cpp b/plugin/business/tsg-http/src/tsg_logger.cpp
index 55b098d..ec289b4 100644
--- a/plugin/business/tsg-http/src/tsg_logger.cpp
+++ b/plugin/business/tsg-http/src/tsg_logger.cpp
@@ -217,9 +217,18 @@ int proxy_send_log(struct proxy_logger* handle, const struct proxy_log* log_msg)
default:
break;
}
- size_t c2s_byte_num = 0, s2c_byte_num =0;
- tfe_stream_info_get(log_msg->stream, INFO_FROM_DOWNSTREAM_RX_OFFSET, &c2s_byte_num, sizeof(c2s_byte_num));
- tfe_stream_info_get(log_msg->stream, INFO_FROM_UPSTREAM_RX_OFFSET, &s2c_byte_num, sizeof(s2c_byte_num));
+
+ size_t ret=0, c2s_byte_num = 0, s2c_byte_num =0;
+ ret = tfe_stream_info_get(log_msg->stream, INFO_FROM_DOWNSTREAM_RX_OFFSET, &c2s_byte_num, sizeof(c2s_byte_num));
+ if(ret != 0)
+ {
+ c2s_byte_num = log_msg->c2s_byte_num;
+ }
+ ret = tfe_stream_info_get(log_msg->stream, INFO_FROM_UPSTREAM_RX_OFFSET, &s2c_byte_num, sizeof(s2c_byte_num));
+ if(ret !=0)
+ {
+ s2c_byte_num = log_msg->s2c_byte_num;
+ }
cJSON_AddNumberToObject(common_obj, "common_link_id", 0);
cJSON_AddNumberToObject(common_obj, "common_stream_dir", 3); //1:c2s, 2:s2c, 3:double