feature: add 'quiet' option to avoid automatic update of LRU list by find session

This commit is contained in:
luwenpeng
2024-07-25 18:50:07 +08:00
parent 5fdf0e2aa4
commit 62b9c0c99c
4 changed files with 40 additions and 34 deletions

View File

@@ -172,7 +172,7 @@ void session_table_del(struct session_table *table, struct session *sess)
table->count--;
}
struct session *session_table_find_sessid(struct session_table *table, uint64_t id)
struct session *session_table_find_sessid(struct session_table *table, uint64_t id, uint8_t quiet)
{
if (table == NULL)
{
@@ -181,7 +181,7 @@ struct session *session_table_find_sessid(struct session_table *table, uint64_t
struct session *sess = NULL;
HASH_FIND(hh3, table->root_sessid, &id, sizeof(uint64_t), sess);
if (sess)
if (sess && !quiet)
{
list_del(&sess->lru);
list_add_tail(&sess->lru, &table->lru_queue);
@@ -190,7 +190,7 @@ struct session *session_table_find_sessid(struct session_table *table, uint64_t
return sess;
}
struct session *session_table_find_tuple6(struct session_table *table, const struct tuple6 *tuple)
struct session *session_table_find_tuple6(struct session_table *table, const struct tuple6 *tuple, uint8_t quiet)
{
if (table == NULL)
{
@@ -199,7 +199,7 @@ struct session *session_table_find_tuple6(struct session_table *table, const str
struct session *sess = NULL;
HASH_FIND(hh1, table->root_tuple6, tuple, sizeof(struct tuple6), sess);
if (sess)
if (sess && !quiet)
{
list_del(&sess->lru);
list_add_tail(&sess->lru, &table->lru_queue);
@@ -208,7 +208,7 @@ struct session *session_table_find_tuple6(struct session_table *table, const str
return sess;
}
struct session *session_table_find_tuple4(struct session_table *table, const struct tuple4 *tuple)
struct session *session_table_find_tuple4(struct session_table *table, const struct tuple4 *tuple, uint8_t quiet)
{
if (table == NULL)
{
@@ -217,7 +217,7 @@ struct session *session_table_find_tuple4(struct session_table *table, const str
struct session *sess = NULL;
HASH_FIND(hh2, table->root_tuple4, tuple, sizeof(struct tuple4), sess);
if (sess)
if (sess && !quiet)
{
list_del(&sess->lru);
list_add_tail(&sess->lru, &table->lru_queue);