diff options
| author | yangwei <[email protected]> | 2024-09-13 10:50:05 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2024-09-13 10:50:05 +0800 |
| commit | 757f937250c281e34b04d0ca3f89627397165599 (patch) | |
| tree | 047f03603faa0dd32f9927220ac6c9ef883add42 /src | |
| parent | c09a89cd588b3ecf09512286076ce18d951c8d87 (diff) | |
🐞 fix(lrustream): 先更新stream,再检查超时
Diffstat (limited to 'src')
| -rw-r--r-- | src/dealpkt/stream_manage.c | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/src/dealpkt/stream_manage.c b/src/dealpkt/stream_manage.c index 75d8aca..0bbcd6b 100644 --- a/src/dealpkt/stream_manage.c +++ b/src/dealpkt/stream_manage.c @@ -564,37 +564,30 @@ int lrustream(struct streamindex *pindex) plist=&(G_MESA_GLOBAL_STREAM[pstream->threadnum]->tcpList[pstream->stream_state]); } - if(1 == del_stream_by_time(plist, pindex, pstream->threadnum, pstream->type)) - { - return 1; - } - else - { - if (pstream->stream_state == TCP_SYN_STATE && pstream->type == STREAM_TYPE_TCP) + if (pstream->stream_state == TCP_SYN_STATE && pstream->type == STREAM_TYPE_TCP) + { + timeouts_add(plist->streamindex_timer, &pindex->timeout, tcp_opening_timeout * 1000 + g_CurrentTime_ms); + } + else if (pstream->stream_state == TCP_NOUSE_STATE && pstream->type == STREAM_TYPE_TCP && + (sapp_global_val->config.stream.tcp.fast_close_discard == 1)) + { + if (pstream_pr->set_special_timeout == 0) { - timeouts_add(plist->streamindex_timer, &pindex->timeout, tcp_opening_timeout * 1000 + g_CurrentTime_ms); - } - else if (pstream->stream_state == TCP_NOUSE_STATE && pstream->type == STREAM_TYPE_TCP && - (sapp_global_val->config.stream.tcp.fast_close_discard == 1)) - { - if(pstream_pr->set_special_timeout==0) - { - 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); - } + timeouts_add(plist->streamindex_timer, &pindex->timeout, tcp_closing_timeout * 1000 + g_CurrentTime_ms); } else { - long set_timeout = pindex->stream.timeout; - if (set_timeout == 0) - set_timeout = MAX_DEFALUT_TIMEOUT_S; - timeouts_add(plist->streamindex_timer, &pindex->timeout, set_timeout * 1000 + g_CurrentTime_ms); + timeouts_add(plist->streamindex_timer, &pindex->timeout, pindex->stream.timeout * 1000 + g_CurrentTime_ms); } } - return 0; + else + { + long set_timeout = pindex->stream.timeout; + if (set_timeout == 0) + set_timeout = MAX_DEFALUT_TIMEOUT_S; + timeouts_add(plist->streamindex_timer, &pindex->timeout, set_timeout * 1000 + g_CurrentTime_ms); + } + return del_stream_by_time(plist, pindex, pstream->threadnum, pstream->type); } static int cmpaddr_mpls(const struct layer_addr_mpls *addr_heap, const struct layer_addr_mpls *addr_stack) |
