diff options
author | hanlin <hanlin_wang@163.com> | 2020-08-21 11:05:36 +0800 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2020-08-26 01:04:50 +0000 |
commit | f8e1363c4fc6b6b258663eeff19ee20d2b038256 (patch) | |
tree | e346c7fce2837bbaae71fc8410a8cd21b347cd48 /src/vcl/vcl_private.h | |
parent | cd631b5ba0bff66b3feb0f9efeebe4864877acca (diff) |
vcl: fix duplicated key of session_index_to_vlsh_table in multiple
threads vcl workers scenario
Type: fix
In multiple threads vcl workers scenario, multiple vcl workes can create
sessions with same index. Because only one vls worker created, key of
session_index_to_vlsh_table is duplicated.
Signed-off-by: hanlin <hanlin_wang@163.com>
Change-Id: I7e1f5bc471adc5378194452aef85e611f5d0df1d
Diffstat (limited to 'src/vcl/vcl_private.h')
-rw-r--r-- | src/vcl/vcl_private.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h index 231d7ebcbcf..c930803f760 100644 --- a/src/vcl/vcl_private.h +++ b/src/vcl/vcl_private.h @@ -404,6 +404,13 @@ vcl_session_get (vcl_worker_t * wrk, u32 session_index) } static inline vcl_session_handle_t +vcl_session_handle_from_wrk_session_index (u32 session_index, u32 wrk_index) +{ + ASSERT (session_index < 2 << 24); + return (wrk_index << 24 | session_index); +} + +static inline vcl_session_handle_t vcl_session_handle_from_index (u32 session_index) { ASSERT (session_index < 2 << 24); |