summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijia <[email protected]>2021-08-12 11:15:30 +0800
committerlijia <[email protected]>2021-08-12 11:15:30 +0800
commit90688a0aef3c3afc9fe6a6142c7b28fca8bdbd40 (patch)
tree401971c6500cb76fcd0be1794639cba56bcfecfb
parente7886b91cd7e69ccf6ca56ce9a4aa59846f11324 (diff)
TSG-7367, 修复不同链接会生成相同stream id的BUG.v4.2.47
-rw-r--r--.gitignore1
-rw-r--r--src/dealpkt/stream_manage.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index cf0ae51..39e2ba3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ SI/
*.a
*.o
*.d
+*.bak
.idea/
bin/log/
bin/sapp
diff --git a/src/dealpkt/stream_manage.c b/src/dealpkt/stream_manage.c
index 42dee9b..5c131bc 100644
--- a/src/dealpkt/stream_manage.c
+++ b/src/dealpkt/stream_manage.c
@@ -3003,11 +3003,12 @@ void free_polling_inject_context(struct streaminfo_private *pstream_pr)
unsigned long long get_global_stream_id(unsigned long long thread_seq)
{
#define RELATIVE_TIME_MAX (268435456L)
+#define THREAD_SEQ_MAX (32768)
unsigned long long glo_sid = 0;
unsigned long long stream_seq;
unsigned long long relative_base_time;
- stream_seq = sapp_global_val->mthread_volatile[thread_seq]->stream_seq_per_thread++;
+ stream_seq = sapp_global_val->mthread_volatile[thread_seq]->stream_seq_per_thread++ % THREAD_SEQ_MAX;
relative_base_time = (sapp_global_val->individual_volatile->current_time - sapp_global_val->config.stream.stream_id_base_time_t) % RELATIVE_TIME_MAX;
glo_sid = (thread_seq << 43) | (relative_base_time << 15) | (stream_seq);