rename: update session pool and packet pool API names for clarity
This commit is contained in:
@@ -15,36 +15,36 @@ TEST(SESSION_POOL, POP_PUSH)
|
||||
EXPECT_TRUE(session_pool_get_used_num(sess_pool) == 0);
|
||||
|
||||
// pop
|
||||
sess1 = session_pool_pop(sess_pool);
|
||||
sess1 = session_pool_acquire_sessoin(sess_pool);
|
||||
EXPECT_TRUE(sess1 != NULL);
|
||||
EXPECT_TRUE(session_pool_get_free_num(sess_pool) == 2);
|
||||
EXPECT_TRUE(session_pool_get_used_num(sess_pool) == 1);
|
||||
|
||||
sess2 = session_pool_pop(sess_pool);
|
||||
sess2 = session_pool_acquire_sessoin(sess_pool);
|
||||
EXPECT_TRUE(sess2 != NULL);
|
||||
EXPECT_TRUE(session_pool_get_free_num(sess_pool) == 1);
|
||||
EXPECT_TRUE(session_pool_get_used_num(sess_pool) == 2);
|
||||
|
||||
sess3 = session_pool_pop(sess_pool);
|
||||
sess3 = session_pool_acquire_sessoin(sess_pool);
|
||||
EXPECT_TRUE(sess3 != NULL);
|
||||
EXPECT_TRUE(session_pool_get_free_num(sess_pool) == 0);
|
||||
EXPECT_TRUE(session_pool_get_used_num(sess_pool) == 3);
|
||||
|
||||
sess4 = session_pool_pop(sess_pool);
|
||||
sess4 = session_pool_acquire_sessoin(sess_pool);
|
||||
EXPECT_TRUE(sess4 == NULL);
|
||||
EXPECT_TRUE(session_pool_get_free_num(sess_pool) == 0);
|
||||
EXPECT_TRUE(session_pool_get_used_num(sess_pool) == 3);
|
||||
|
||||
// push
|
||||
session_pool_push(sess_pool, sess1);
|
||||
session_pool_release_sessoin(sess_pool, sess1);
|
||||
EXPECT_TRUE(session_pool_get_free_num(sess_pool) == 1);
|
||||
EXPECT_TRUE(session_pool_get_used_num(sess_pool) == 2);
|
||||
|
||||
session_pool_push(sess_pool, sess2);
|
||||
session_pool_release_sessoin(sess_pool, sess2);
|
||||
EXPECT_TRUE(session_pool_get_free_num(sess_pool) == 2);
|
||||
EXPECT_TRUE(session_pool_get_used_num(sess_pool) == 1);
|
||||
|
||||
session_pool_push(sess_pool, sess3);
|
||||
session_pool_release_sessoin(sess_pool, sess3);
|
||||
EXPECT_TRUE(session_pool_get_free_num(sess_pool) == 3);
|
||||
EXPECT_TRUE(session_pool_get_used_num(sess_pool) == 0);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ static void session_free_callback(struct session *sess, void *arg)
|
||||
if (sess)
|
||||
{
|
||||
struct session_pool *sess_pool = (struct session_pool *)arg;
|
||||
session_pool_push(sess_pool, sess);
|
||||
session_pool_release_sessoin(sess_pool, sess);
|
||||
sess = NULL;
|
||||
}
|
||||
}
|
||||
@@ -106,17 +106,17 @@ TEST(SESSION_TABLE, OP_SESSION)
|
||||
session_table_set_freecb(sess_table, session_free_callback, sess_pool);
|
||||
|
||||
// Add
|
||||
sess1 = session_pool_pop(sess_pool);
|
||||
sess1 = session_pool_acquire_sessoin(sess_pool);
|
||||
EXPECT_TRUE(sess1 != NULL);
|
||||
session_set_id(sess1, 1);
|
||||
session_set_tuple6(sess1, &sess1_tup6);
|
||||
|
||||
sess2 = session_pool_pop(sess_pool);
|
||||
sess2 = session_pool_acquire_sessoin(sess_pool);
|
||||
EXPECT_TRUE(sess2 != NULL);
|
||||
session_set_id(sess2, 2);
|
||||
session_set_tuple6(sess2, &sess2_tup6);
|
||||
|
||||
sess3 = session_pool_pop(sess_pool);
|
||||
sess3 = session_pool_acquire_sessoin(sess_pool);
|
||||
EXPECT_TRUE(sess3 != NULL);
|
||||
session_set_id(sess3, 3);
|
||||
session_set_tuple6(sess3, &sess3_tup6);
|
||||
@@ -200,21 +200,21 @@ TEST(SESSION_TABLE, FIND_OLDEST_NEWEST)
|
||||
|
||||
EXPECT_TRUE(session_table_find_lru(sess_table) == NULL);
|
||||
|
||||
sess1 = session_pool_pop(sess_pool);
|
||||
sess1 = session_pool_acquire_sessoin(sess_pool);
|
||||
EXPECT_TRUE(sess1 != NULL);
|
||||
session_set_id(sess1, 1);
|
||||
session_set_tuple6(sess1, &sess1_tup6);
|
||||
session_table_add(sess_table, sess1);
|
||||
EXPECT_TRUE(session_table_find_lru(sess_table) == sess1);
|
||||
|
||||
sess2 = session_pool_pop(sess_pool);
|
||||
sess2 = session_pool_acquire_sessoin(sess_pool);
|
||||
EXPECT_TRUE(sess2 != NULL);
|
||||
session_set_id(sess2, 2);
|
||||
session_set_tuple6(sess2, &sess2_tup6);
|
||||
session_table_add(sess_table, sess2);
|
||||
EXPECT_TRUE(session_table_find_lru(sess_table) == sess1);
|
||||
|
||||
sess3 = session_pool_pop(sess_pool);
|
||||
sess3 = session_pool_acquire_sessoin(sess_pool);
|
||||
EXPECT_TRUE(sess3 != NULL);
|
||||
session_set_id(sess3, 3);
|
||||
session_set_tuple6(sess3, &sess3_tup6);
|
||||
|
||||
Reference in New Issue
Block a user