优化tsg proxy的处理流程

This commit is contained in:
liuchang
2023-05-16 08:04:43 +00:00
parent 90dbd4030e
commit ee65078252
3 changed files with 8 additions and 19 deletions

View File

@@ -1958,11 +1958,6 @@ static unsigned char tsg_master_all_entry(const struct streaminfo *a_stream, uns
struct maat_rule shaping_results[MAX_RESULT_NUM]={0}; struct maat_rule shaping_results[MAX_RESULT_NUM]={0};
struct session_runtime_action_context *srt_action_context=(struct session_runtime_action_context *)(*pme); struct session_runtime_action_context *srt_action_context=(struct session_runtime_action_context *)(*pme);
if (a_stream->type == STREAM_TYPE_TCP && a_packet != NULL)
{
tsg_proxy_tcp_options_parse(a_stream, a_packet);
}
if(stream_state==OP_STATE_PENDING && srt_action_context->method_type!=TSG_METHOD_TYPE_SHUNT && !(srt_action_context->udp_data_dropme)) if(stream_state==OP_STATE_PENDING && srt_action_context->method_type!=TSG_METHOD_TYPE_SHUNT && !(srt_action_context->udp_data_dropme))
{ {
if(srt_action_context->method_type==TSG_METHOD_TYPE_UNKNOWN) if(srt_action_context->method_type==TSG_METHOD_TYPE_UNKNOWN)
@@ -2184,6 +2179,11 @@ extern "C" unsigned char TSG_MASTER_TCPALL_ENTRY(const struct streaminfo *a_tcp,
{ {
_context->set_latency_flag=session_tcp_establish_latency_ms_set(a_tcp, thread_seq, a_packet); _context->set_latency_flag=session_tcp_establish_latency_ms_set(a_tcp, thread_seq, a_packet);
} }
if (a_packet != NULL)
{
tsg_proxy_tcp_options_parse(a_tcp, a_packet);
}
unsigned char state=tsg_master_all_entry(a_tcp, a_tcp->pktstate, pme, thread_seq, a_packet); unsigned char state=tsg_master_all_entry(a_tcp, a_tcp->pktstate, pme, thread_seq, a_packet);

View File

@@ -318,7 +318,7 @@ void tsg_proxy_tcp_options_parse(const struct streaminfo *stream, const void *a_
return; return;
} }
if (tcp_attr->ignore) { if (tcp_attr->first_data_pkt_processed) {
return; return;
} }
@@ -330,18 +330,8 @@ void tsg_proxy_tcp_options_parse(const struct streaminfo *stream, const void *a_
} }
if(stream->ptcpdetail->datalen > 0) { if(stream->ptcpdetail->datalen > 0) {
if (tcp_attr->first_data_pkt_processed) { tsg_proxy_first_data_process(stream, tcp_attr, &pktinfo);
struct maat_rule maat_rule; tcp_attr->first_data_pkt_processed = 1;
int rule_num;
rule_num = session_matched_rules_copy(stream, TSG_SERVICE_INTERCEPT, &maat_rule, 1);
if (rule_num == 0) {
tcp_attr->ignore = 1;
}
} else {
tsg_proxy_first_data_process(stream, tcp_attr, &pktinfo);
tcp_attr->first_data_pkt_processed = 1;
}
return; return;
} }

View File

@@ -20,7 +20,6 @@ struct tsg_proxy_tcp_option
struct tsg_proxy_tcp_attribute struct tsg_proxy_tcp_attribute
{ {
uint8_t first_data_pkt_processed; uint8_t first_data_pkt_processed;
uint8_t ignore;
uint32_t tcp_seq; uint32_t tcp_seq;
uint32_t tcp_ack; uint32_t tcp_ack;
uint8_t tcp_protocol; uint8_t tcp_protocol;