optimizate: pass the current timeout to the ID generator as a parameter, instead of getting the time from the ID generator itself

This commit is contained in:
luwenpeng
2024-07-16 17:13:32 +08:00
parent 07ce636f64
commit b50f0c2c70
21 changed files with 197 additions and 201 deletions

View File

@@ -1,9 +1,9 @@
#include <gtest/gtest.h>
#include "tuple.h"
#include "times.h"
#include "packet_def.h"
#include "packet_parse.h"
#include "id_generator.h"
#include "session_utils.h"
#include "session_manager.h"
#include "tcp_reassembly.h"
@@ -307,7 +307,6 @@ TEST(CASE, TCP_FAST_OPEN)
struct session_manager *mgr = NULL;
struct session_manager_stat *stat = NULL;
stellar_update_time_cache();
mgr = session_manager_new(&opts, 1);
EXPECT_TRUE(mgr != NULL);
@@ -421,6 +420,11 @@ TEST(CASE, TCP_FAST_OPEN)
int main(int argc, char **argv)
{
struct id_generator_options opt = {
.snowflake_worker_id_base = 1,
.snowflake_worker_id_offset = 2,
};
id_generator_init(&opt);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}