summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-04-18 18:34:09 +0800
committeryangwei <[email protected]>2024-04-21 01:51:08 +0800
commit0ed228dcf6f2f8524ed054e28b4aa838438436cd (patch)
tree74e35218a3436e21b62e187ae53593bf58dfad34
parent6c1e6a601220a9281744f5ed626d7468b2871b8f (diff)
🐞 fix(stream_set_single_stream_timeout): 同时判断opstate和pktstate为close,才返回失效
-rw-r--r--src/dealpkt/stream_manage.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/dealpkt/stream_manage.c b/src/dealpkt/stream_manage.c
index fa91548..9bfc853 100644
--- a/src/dealpkt/stream_manage.c
+++ b/src/dealpkt/stream_manage.c
@@ -242,7 +242,7 @@ int stream_set_single_stream_timeout(const struct streaminfo *pstream,unsigned s
struct streaminfo_private *pstream_pr=(struct streaminfo_private *)pstream;
struct streamindex *pindex;
- if(OP_STATE_CLOSE == pstream->opstate){/* ��ǰ���ѽ���, ���賬ʱҲû�������� */
+ if(OP_STATE_CLOSE == pstream->opstate && OP_STATE_CLOSE == pstream->pktstate){/* ��ǰ���ѽ���, ���賬ʱҲû�������� */
return -1;
}
@@ -386,9 +386,16 @@ void streamaddlist(struct streamindex *pindex,struct stream_list *plist)
next_timeout_ms = tcp_opening_timeout * 1000 + g_CurrentTime_ms;
}
else if ((pstream->stream_state == TCP_NOUSE_STATE && pstream->type == STREAM_TYPE_TCP) &&
- (pstream_pr->set_special_timeout == 0 || sapp_global_val->config.stream.tcp.nouse_set_special_timeout == 0))
+ (pstream_pr->set_special_timeout == 0 || sapp_global_val->config.stream.tcp.nouse_set_special_timeout == 0))
{
- next_timeout_ms = tcp_closing_timeout * 1000 + g_CurrentTime_ms;
+ if(pstream->opstate == OP_STATE_CLOSE && pstream->pktstate == OP_STATE_CLOSE)
+ {
+ next_timeout_ms = tcp_closing_timeout * 1000 + g_CurrentTime_ms;
+ }
+ else
+ {
+ next_timeout_ms = pindex->stream.timeout * 1000 + g_CurrentTime_ms;
+ }
}
else
{
@@ -606,7 +613,14 @@ int lrustream(struct streamindex *pindex)
else if (pstream->stream_state == TCP_NOUSE_STATE && pstream->type == STREAM_TYPE_TCP &&
(pstream_pr->set_special_timeout == 0 || sapp_global_val->config.stream.tcp.nouse_set_special_timeout == 0))
{
- timeouts_add(plist->streamindex_timer, &pindex->timeout, tcp_closing_timeout * 1000 + g_CurrentTime_ms);
+ if(pstream->opstate == OP_STATE_CLOSE && pstream->pktstate == OP_STATE_CLOSE)
+ {
+ timeouts_add(plist->streamindex_timer, &pindex->timeout, tcp_closing_timeout * 1000 + g_CurrentTime_ms);
+ }
+ else
+ {
+ timeouts_add(plist->streamindex_timer, &pindex->timeout, pindex->stream.timeout * 1000 + g_CurrentTime_ms);
+ }
}
else
{