bugfix: packet IO load marsio config

This commit is contained in:
luwenpeng
2024-11-01 16:14:43 +08:00
parent 021042b752
commit a415794428
3 changed files with 12 additions and 6 deletions

View File

@@ -44,22 +44,26 @@ static struct mars_io_cfg *mars_io_cfg_new(const char *toml_file)
}
int ret = 0;
int num = 0;
int num = load_toml_array_config(toml_file, "packet_io.cpu_mask", cfg->cpu_mask, MAX_THREAD_NUM);
ret += load_toml_str_config(toml_file, "packet_io.app_symbol", cfg->app_symbol);
ret += load_toml_str_config(toml_file, "packet_io.dev_symbol", cfg->dev_symbol);
ret += load_toml_integer_config(toml_file, "packet_io.thread_num", &cfg->thread_num, 1, MAX_THREAD_NUM);
ret += load_toml_integer_config(toml_file, "packet_io.idle_yield_ms", &cfg->idle_yield_ms, 0, 60000);
num = load_toml_array_config(toml_file, "packet_io.cpu_mask", cfg->cpu_mask, MAX_THREAD_NUM);
ret += load_toml_integer_config(toml_file, "packet_io.packet_pool.capacity", &cfg->capacity, 1, 4294967295);
if (ret != 0 || num != (int)cfg->thread_num)
if (ret != 0)
{
free(cfg);
return NULL;
}
else
if (num < (int)cfg->thread_num)
{
return cfg;
PACKET_IO_LOG_ERROR("cpu mask number: %d less than thread number: %lu", num, cfg->thread_num);
free(cfg);
return NULL;
}
return cfg;
}
static void mars_io_cfg_free(struct mars_io_cfg *cfg)

View File

@@ -333,6 +333,7 @@ static inline int load_toml_array_config(const char *toml_file, const char *key,
}
arr = get_toml_array_by_hierarchical_key(root, key);
if (arr == NULL)
{
STELLAR_LOG_ERROR(__thread_local_logger, "config", "config file missing %s", key);
goto error_out;