summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/CMakeLists.txt3
-rw-r--r--infra/packet_io/mars_io.c14
-rw-r--r--infra/utils_internal.h1
3 files changed, 12 insertions, 6 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 0e982cb..4968b32 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -3,4 +3,5 @@ install(FILES stellar/packet.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
install(FILES stellar/session.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
install(FILES stellar/stellar.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
install(FILES stellar/mq.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
-install(FILES stellar/exdata.h DESTINATION include/stellar/ COMPONENT LIBRARIES) \ No newline at end of file
+install(FILES stellar/exdata.h DESTINATION include/stellar/ COMPONENT LIBRARIES)
+install(FILES stellar/log.h DESTINATION include/stellar/ COMPONENT LIBRARIES) \ No newline at end of file
diff --git a/infra/packet_io/mars_io.c b/infra/packet_io/mars_io.c
index 5f3a0d9..6ce3de4 100644
--- a/infra/packet_io/mars_io.c
+++ b/infra/packet_io/mars_io.c
@@ -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)
diff --git a/infra/utils_internal.h b/infra/utils_internal.h
index 20ff0a2..c026418 100644
--- a/infra/utils_internal.h
+++ b/infra/utils_internal.h
@@ -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;