update session table add/del API

This commit is contained in:
luwenpeng
2024-04-30 15:29:31 +08:00
parent e418c84b85
commit dc37306594
4 changed files with 30 additions and 39 deletions

View File

@@ -139,16 +139,11 @@ void session_table_set_freecb(struct session_table *table, session_free_cb free_
}
}
int session_table_add(struct session_table *table, const struct tuple6 *tuple, struct session *sess)
void session_table_add(struct session_table *table, struct session *sess)
{
if (table == NULL || sess == NULL)
{
return -1;
}
if (session_table_find_tuple6(table, tuple))
{
return -1;
return;
}
HASH_ADD(hh1, table->root_tuple6, tuple, sizeof(struct tuple6), sess);
@@ -156,19 +151,11 @@ int session_table_add(struct session_table *table, const struct tuple6 *tuple, s
HASH_ADD(hh3, table->root_sessid, id, sizeof(uint64_t), sess);
list_add_tail(&sess->lru, &table->lru_queue);
table->count++;
return 0;
}
void session_table_del(struct session_table *table, const struct tuple6 *tuple)
void session_table_del(struct session_table *table, struct session *sess)
{
if (table == NULL)
{
return;
}
struct session *sess = session_table_find_tuple6(table, tuple);
if (sess == NULL)
if (table == NULL || sess == NULL)
{
return;
}