diff options
| author | yangwei <[email protected]> | 2023-10-26 13:41:55 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2023-10-26 13:41:55 +0800 |
| commit | d6e102166fed904b6d3adbdd7f77cb251614e9c3 (patch) | |
| tree | 7d23e508250272fa61bb76d7b77bc6d4419d5464 | |
| parent | 246603d22613baefe900c26c36d4a434a1aaf761 (diff) | |
🐞 fix(stream bridge destroy ): pdate Destruction Timing
| -rw-r--r-- | src/dealpkt/deal_tcp.c | 37 | ||||
| -rw-r--r-- | src/dealpkt/deal_udp.c | 11 |
2 files changed, 28 insertions, 20 deletions
diff --git a/src/dealpkt/deal_tcp.c b/src/dealpkt/deal_tcp.c index 633dbca..57ace72 100644 --- a/src/dealpkt/deal_tcp.c +++ b/src/dealpkt/deal_tcp.c @@ -1401,14 +1401,6 @@ int tcp_free_stream(struct streamindex *pindex, const void *this_ip_hdr, const v pkt_ret = stream_process_tcp(pstream, this_ip_hdr, transport_hdr, raw_pkt,&(pdetail_pr->apme),&(pstream->opstate)); pdetail_pr->apme=NULL; } - if(pclient){ - tcp_free_half(pclient,threadnum); - pclient = NULL; - } - if(pserver){ - tcp_free_half(pserver,threadnum); - pserver = NULL; - } } //�����κ�״̬�ص�ȫ�������������� @@ -1425,7 +1417,21 @@ int tcp_free_stream(struct streamindex *pindex, const void *this_ip_hdr, const v pdetail_pr->pAllpktpme=NULL; } - /* �����������ٴӽṹ���Ƴ�, ��Ϊ���ò��ʱ, ���ܻ����stream_set_single_stream_timeout(), �������ǰ����LRU�����е�λ�� */ + project_requirement_destroy(SAPP_MEM_DYN_TCP_PROJECT, threadnum, pstream_pr->pproject); + pstream_pr->pproject = NULL; + stream_bridge_destroy_per_stream(SAPP_MEM_DYN_TCP_BRIDGE, pstream, pstream_pr->stream_bridge); + pstream_pr->stream_bridge = NULL; + if (pclient) + { + tcp_free_half(pclient, threadnum); + pclient = NULL; + } + if (pserver) + { + tcp_free_half(pserver, threadnum); + pserver = NULL; + } + /* �����������ٴӽṹ���Ƴ�, ��Ϊ���ò��ʱ, ���ܻ����stream_set_single_stream_timeout(), �������ǰ����LRU�����е�λ�� */ streamleavlist(pindex, plist); hash_del_stream(pindex); @@ -1435,10 +1441,7 @@ int tcp_free_stream(struct streamindex *pindex, const void *this_ip_hdr, const v pstream->pdetail=NULL; } - project_requirement_destroy(SAPP_MEM_DYN_TCP_PROJECT, threadnum, pstream_pr->pproject); - pstream_pr->pproject = NULL; - stream_bridge_destroy_per_stream(SAPP_MEM_DYN_TCP_BRIDGE, pstream, pstream_pr->stream_bridge); - pstream_pr->stream_bridge = NULL; + if(pstream_pr->timeout > link_default_nopkt_time){ /* ���Ӷ��г�ʱʱ��, ���ټ��� */ sapp_global_mthread[threadnum].tcp_stream_special_timeout_num--; @@ -1584,14 +1587,16 @@ static int tcp_reset_stream(struct streamindex *pindex,const void *this_iphdr, pdetail_pr->pAllpktpme=NULL; } - /* �����������ٴӽṹ���Ƴ�, ��Ϊ���ò��ʱ, ���ܻ����stream_set_single_stream_timeout(), �������ǰ����LRU�����е�λ�� */ - streamleavlist(pindex, plist); - project_requirement_destroy(SAPP_MEM_DYN_TCP_PROJECT, threadnum, pstream_pr->pproject); pstream_pr->pproject = NULL; stream_bridge_destroy_per_stream(SAPP_MEM_DYN_TCP_BRIDGE, pstream, pstream_pr->stream_bridge); pstream_pr->stream_bridge = NULL; + + /* �����������ٴӽṹ���Ƴ�, ��Ϊ���ò��ʱ, ���ܻ����stream_set_single_stream_timeout(), �������ǰ����LRU�����е�λ�� */ + streamleavlist(pindex, plist); + + /* �ָ�֮ǰ�洢��raw_pkt */ pstream_pr->raw_pkt = saved_raw_pkt; diff --git a/src/dealpkt/deal_udp.c b/src/dealpkt/deal_udp.c index df96e85..45ef35f 100644 --- a/src/dealpkt/deal_udp.c +++ b/src/dealpkt/deal_udp.c @@ -326,6 +326,13 @@ void udp_free_stream(struct streamindex *pindex) } plist=&(G_MESA_GLOBAL_STREAM[threadnum]->udpList[pstream->stream_state]); + + project_requirement_destroy(SAPP_MEM_DYN_UDP_PROJECT, threadnum, pstream_pr->pproject); + pstream_pr->pproject = NULL; + + stream_bridge_destroy_per_stream(SAPP_MEM_DYN_UDP_BRIDGE, pstream, pstream_pr->stream_bridge); + pstream_pr->stream_bridge = NULL; + streamleavlist(pindex, plist); hash_del_stream(pindex); sapp_runtime_log(RLOG_LV_DEBUG, "udp_free_stream: %s, thread:%d, stream_type:%d, stream_state:%d, curtime:%ld!", @@ -339,11 +346,7 @@ void udp_free_stream(struct streamindex *pindex) sapp_mem_free(SAPP_MEM_DYN_UDP_DETAIL, threadnum,pstream->pdetail); } pstream->pdetail=NULL; - project_requirement_destroy(SAPP_MEM_DYN_UDP_PROJECT, threadnum, pstream_pr->pproject); - pstream_pr->pproject = NULL; - stream_bridge_destroy_per_stream(SAPP_MEM_DYN_UDP_BRIDGE, pstream, pstream_pr->stream_bridge); - pstream_pr->stream_bridge = NULL; if(pstream_pr->timeout > udp_reset_time){ /* ���Ӷ��г�ʱʱ��, ���ټ��� */ sapp_global_mthread[threadnum].udp_stream_special_timeout_num--; |
