summaryrefslogtreecommitdiff
path: root/src/tsg_send_log.cpp
diff options
context:
space:
mode:
authorliuxueli <[email protected]>2023-01-11 14:52:48 +0800
committerliuxueli <[email protected]>2023-01-11 14:52:48 +0800
commit7ea9288da4d86e15205e633e307f696e6cafc6cd (patch)
tree11beefd6ae1b5e71513f88a2b5385b97fcf1b886 /src/tsg_send_log.cpp
parent8e48dfd98279582033ce68d8a052ec87cf87d457 (diff)
TSG-13031: 没有原始数据包时获取direction可能存在异常,调整获取direction的时机,即在第一个数据包时获取direction
Diffstat (limited to 'src/tsg_send_log.cpp')
-rw-r--r--src/tsg_send_log.cpp35
1 files changed, 5 insertions, 30 deletions
diff --git a/src/tsg_send_log.cpp b/src/tsg_send_log.cpp
index 77b814c..6fce17c 100644
--- a/src/tsg_send_log.cpp
+++ b/src/tsg_send_log.cpp
@@ -382,39 +382,14 @@ static int set_location(struct TLD_handle_t *_handle, struct streaminfo *a_strea
static int set_direction(struct tsg_log_instance_t *_instance, struct TLD_handle_t *_handle, struct streaminfo *a_stream)
{
- int direction=0,i_or_e=0;
-
- i_or_e=MESA_dir_link_to_human(a_stream->routedir);
- switch(a_stream->curdir)
+ char direction=get_direction_from_tcpall(a_stream);
+ if(direction>0)
{
- case DIR_C2S:
- if(i_or_e=='E' || i_or_e=='e')
- {
- direction='E';
- }
- else
- {
- direction='I';
- }
- break;
- case DIR_S2C:
- if(i_or_e=='E' || i_or_e=='e')
- {
- direction='I';
- }
- else
- {
- direction='E';
- }
- break;
- default:
- break;
+ TLD_append(_handle, _instance->id2field[LOG_COMMON_DIRECTION].name, (void *)(long)direction, TLD_TYPE_LONG);
+ return 1;
}
-
- TLD_append(_handle, _instance->id2field[LOG_COMMON_DIRECTION].name, (void *)(long)direction, TLD_TYPE_LONG);
-
- return 1;
+ return 0;
}
static int set_address_list(struct tsg_log_instance_t *_instance, struct TLD_handle_t *_handle, struct streaminfo *a_stream)