diff --git a/.gitignore b/.gitignore index 667d2f23f1e56a0ce1ca9150ae7f276cdf3221dd..85330064fb9534c3b65b95cfb9a0701e1aedb2cd 100644 --- a/.gitignore +++ b/.gitignore @@ -56,7 +56,7 @@ dkms.conf /.project /.cproject /kelvin-node_logs.txt -/build/ +/build*/ # Autogenerated CMake files CMakeCache.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee1e301e12980f7b45e0e6374d923ab0520e8ba3..2b69327a9091ed8654ddb033b3addd78921a5496 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,8 +6,8 @@ stages: variables: GIT_SUBMODULE_STRATEGY: normal -kelvin-node-schedule: +cellframe-node-schedule: stage: build tags: - cellframe-node - script: ~/production/integration/gitlab-CI/build_all_handler.sh cellframe-node \ No newline at end of file + script: ~/production/integration/gitlab-CI/build_all_handler.sh cellframe-node diff --git a/CMakeLists.txt b/CMakeLists.txt index 84f9952c06312d09f40e215643be345845c18272..cf9d4f5a0987ffcbcc1501c7d907aa783cec5468 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,36 +8,42 @@ set(CMAKE_C_STANDARD 11) SET( CPACK_PACKAGE_NAME "${PROJECT_NAME}") SET( CPACK_PACKAGE_VERSION_MAJOR 5) SET( CPACK_PACKAGE_VERSION_MINOR 0) -SET( CPACK_PACKAGE_VERSION_PATCH 0) +SET( CPACK_PACKAGE_VERSION_PATCH 5) # init CellFrame SDK add_definitions("-DDAP_VERSION=\"${CPACK_PACKAGE_VERSION_MAJOR}-${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}\"") set(SUBMODULES_NO_BUILD ON) include (cellframe-sdk/cmake/OS_Detection.cmake) +#set(BUILD_WITH_GDB_DRIVER_PGSQL ON) +#set(BUILD_CRYPTO_TESTS ON) + if(BUILD_WITH_GDB_DRIVER_MDBX) add_subdirectory(3rdparty/libmdbx) endif() -if((LINUX)) +if(LINUX) set(SUPPORT_PYTHON_PLUGINS ON) endif() if (WIN32) - set(CELLFRAME_MODULES "core chains mining network srv cs-blocks cs-dag-poa cs-block-poa cs-dag-pos cs-none srv-app srv-app-db srv-datum srv-stake srv-xchange modules-dynamic") + set(CELLFRAME_MODULES "core chains mining network srv cs-blocks cs-dag-poa cs-block-poa cs-dag-pos cs-none srv-app srv-app-db srv-datum srv-stake srv-xchange") elseif(BSD) - set(CELLFRAME_MODULES "core chains mining network srv cs-blocks cs-dag-poa cs-block-poa cs-dag-pos cs-none srv-app srv-app-db srv-datum srv-stake srv-xchange modules-dynamic") + set(CELLFRAME_MODULES "core chains mining network srv cs-blocks cs-dag-poa cs-block-poa cs-dag-pos cs-none srv-app srv-app-db srv-datum srv-stake srv-xchange") elseif(DARWIN) - set(CELLFRAME_MODULES "core chains mining network srv cs-blocks cs-dag-poa cs-block-poa cs-dag-pos cs-none srv-app srv-app-db srv-datum srv-stake srv-xchange modules-dynamic") + set(CELLFRAME_MODULES "core chains mining network srv cs-blocks cs-dag-poa cs-block-poa cs-dag-pos cs-none srv-app srv-app-db srv-datum srv-stake srv-xchange") elseif(ANDROID) set(CELLFRAME_MODULES "core chains mining network srv cs-blocks cs-dag-poa cs-block-poa cs-dag-pos cs-none srv-app srv-app-db srv-datum srv-stake srv-xchange") elseif(LINUX) set(CELLFRAME_MODULES "core chains mining network srv cs-blocks cs-dag-poa cs-block-poa cs-dag-pos cs-none srv-app srv-app-db srv-datum srv-stake srv-xchange modules-dynamic srv-vpn") endif() -add_subdirectory(cellframe-sdk) +if (CELLFRAME_MODULES MATCHES "modules-dynamic") + add_definitions("-DDAP_MODULES_DYNAMIC") +endif() +add_subdirectory(cellframe-sdk) if(UNIX) if(DARWIN) @@ -73,6 +79,9 @@ if(UNIX) SET( CPACK_SYSTEM_ARCH "amd64") SET( CPACK_SYSTEM_CODENAME "${DEBIAN_OS_NAME}") SET( CPACK_SYSTEM_NAME "${CPACK_SYSTEM_TYPE}-${CPACK_SYSTEM_VERSION}-${CPACK_SYSTEM_ARCH}-${CPACK_SYSTEM_CODENAME}") + if(BUILD_WITH_GDB_DRIVER_PGSQL) + SET( CPACK_SYSTEM_NAME "${CPACK_SYSTEM_NAME}-pgsql" ) + endif() if(CMAKE_BUILD_TYPE MATCHES Debug) SET( CPACK_SYSTEM_NAME "${CPACK_SYSTEM_NAME}-dbg" ) endif() diff --git a/README.md b/README.md index b31b2d32427f649216e3155943d29a1356faffa8..bd343f782347f76853886cdcb7d3ac3cbeab9006 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ To successfully complete of the build, you need to have the following packages t Please use the command below to install dependencies listed above ``` -sudo apt-get install build-essential cmake dpkg-dev libpython3-dev libjson-c-dev libsqlite3-dev libmemcached-dev libev-dev libmagic-dev libcurl4-gnutls-dev libldb-dev libtalloc-dev libtevent-dev traceroute +sudo apt-get install build-essential cmake dpkg-dev libpython3-dev libjson-c-dev libsqlite3-dev libmemcached-dev libev-dev libmagic-dev libcurl4-gnutls-dev libldb-dev libtalloc-dev libtevent-dev traceroute debconf-utils pv ``` #### MacOS Prerequsites @@ -46,7 +46,7 @@ This command fetch sources from gitlab and build them. cd cellframe-sdk git submodule update --init cd ../ - cd cellframe-sdk-python + cd python-cellframe git submodule update --init cd ../ ``` @@ -132,6 +132,12 @@ Network address used for listentning. Set ```0.0.0.0``` if you want to listen al * Server port (optional, usually don't ask) Server port, 8079 by default but sometimes better to set it to ```80``` or ```443``` to masquarade service as web service. +* Core-testnet: Enable network +Set ```true``` if you want to connect your node with ```Core-T testnet``` + +* Core-testnet: Node type (role) +Select node type (or node role) from suggested list with short descriptions. By default suggested to select ```full``` + * Kelvin-testnet: Enable network Set ```true``` if you want to connect your node with ```kelvin-testnet``` @@ -141,7 +147,7 @@ Select node type (or node role) from suggested list with short descriptions. By ### How to configure VPN service share #### Node base configuration -Open ```/opt/cellframe-node/etc/cellframe-node.conf``` with command ```sudo nano /opt/cellframe-node/etc/cellframe-node.conf``` and find next section: +Open ```/opt/cellframe-node/etc/cellframe-node.cfg``` with command ```sudo nano /opt/cellframe-node/etc/cellframe-node.cfg``` and find next section: ``` # VPN stream channel processing module diff --git a/cellframe-sdk b/cellframe-sdk index f640c396592285969bbbfce58254f6b6711c0e2f..89054f9448ff81b0963be2e6f1ae51f933d14689 160000 --- a/cellframe-sdk +++ b/cellframe-sdk @@ -1 +1 @@ -Subproject commit f640c396592285969bbbfce58254f6b6711c0e2f +Subproject commit 89054f9448ff81b0963be2e6f1ae51f933d14689 diff --git a/dist.linux/share/cellframe-node.service b/dist.linux/share/cellframe-node.service index 7516a32a08d3685680915aedf24dfba7626125e9..fafa0a2ee1a0b55cfa24422c20843514b62682d1 100644 --- a/dist.linux/share/cellframe-node.service +++ b/dist.linux/share/cellframe-node.service @@ -15,7 +15,7 @@ Restart=always #Group=cellframe-node User=root Group=root -#CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_IPC_LOCK CAP_KILL CAP_LEASE CAP_MKNOD CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_RAWIO CAP_SYSLOG CAP_WAKE_ALARM +CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_IPC_LOCK CAP_KILL CAP_LEASE CAP_MKNOD CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_RAWIO CAP_SYSLOG CAP_WAKE_ALARM [Install] WantedBy=multi-user.target diff --git a/dist/share/configs/cellframe-node.cfg.tpl b/dist/share/configs/cellframe-node.cfg.tpl index fce6ce9e687261deae7e63c1a13d535fcddbfad6..32c27b944a228b831fa21b3da7e4251724f5a098 100644 --- a/dist/share/configs/cellframe-node.cfg.tpl +++ b/dist/share/configs/cellframe-node.cfg.tpl @@ -31,6 +31,11 @@ listen_port_tcp={SERVER_PORT} # If not set - used listen_port_tcp for node table auto fill #ext_port_tcp=8089 +[stream] +# For now its IAES but thats depricated +#preferred_encryption=SALSA2012 +# Debug stream protocol +#debug=true # Build in DNS client (need for bootstraping) [dns_client] @@ -95,7 +100,8 @@ enabled=true #listen_port_tcp=12345 listen_unix_socket_path={PREFIX}/var/run/node_cli # Default permissions 770 -#listen_unix_socket_permissions=770 +# IMPORTANT! Its accessible for all the users in system! +listen_unix_socket_permissions=777 # Application Resources [resources] @@ -119,4 +125,4 @@ dap_global_db_driver=sqlite3 # Load Python-based plugins #py_load=false # Path to Pyhon-based plugins -#py_path={PREFIX}/var/lib/plugins \ No newline at end of file +#py_path={PREFIX}/var/lib/plugins diff --git a/prod_build b/prod_build index 9f8b3d60b3c210923aff5edce4f8a1cf41fdd748..765ecc3ab4425e9ce0b9a3e3bd4accecd4ebdde4 160000 --- a/prod_build +++ b/prod_build @@ -1 +1 @@ -Subproject commit 9f8b3d60b3c210923aff5edce4f8a1cf41fdd748 +Subproject commit 765ecc3ab4425e9ce0b9a3e3bd4accecd4ebdde4 diff --git a/python-cellframe b/python-cellframe index c22833d8ca9e182baf190016aec2ffb5579e5eae..a5898577446f2a1043646cdac84e23a517a5de42 160000 --- a/python-cellframe +++ b/python-cellframe @@ -1 +1 @@ -Subproject commit c22833d8ca9e182baf190016aec2ffb5579e5eae +Subproject commit a5898577446f2a1043646cdac84e23a517a5de42 diff --git a/scripts.darwin/create_configs.sh b/scripts.darwin/create_configs.sh index 04d07cc65d8b730886322e559aee0c607d21af76..dc5abc427053552c355cbb8851670ee2fbc41d59 100755 --- a/scripts.darwin/create_configs.sh +++ b/scripts.darwin/create_configs.sh @@ -17,4 +17,5 @@ export DAP_SERVER_PORT=8089 export DAP_CORE_T_ENABLED=true export DAP_CORE_T_ROLE=full +echo "Init configs with prefix " $DAP_PREFIX ../scripts/create_configs_from_tpl.sh diff --git a/scripts/create_configs_from_tpl.sh b/scripts/create_configs_from_tpl.sh index a8b9568a668b0038ec13307fbcca43c865e1a629..76ccb571e8aa3b5923d303f27b1c597466345937 100755 --- a/scripts/create_configs_from_tpl.sh +++ b/scripts/create_configs_from_tpl.sh @@ -40,12 +40,12 @@ else fi cat $DAP_CFG_TPL > $DAP_CFG || true -sed -i .old "s/{DEBUG_MODE}/$DAP_DEBUG_MODE /" $DAP_CFG || true -sed -i .old "s/{AUTO_ONLINE}/$DAP_AUTO_ONLINE/" $DAP_CFG || true -sed -i .old "s/{SERVER_ENABLED}/$DAP_SERVER_ENABLED/" $DAP_CFG || true -sed -i .old "s/{SERVER_PORT}/$DAP_SERVER_PORT/" $DAP_CFG || true -sed -i .old "s/{SERVER_ADDR}/$DAP_SERVER_ADDR/" $DAP_CFG || true -sed -i .old "s/{PREFIX}/$DAP_PREFIX_TPL/" $DAP_CFG || true +sed -i .old "s/{DEBUG_MODE}/$DAP_DEBUG_MODE/g" $DAP_CFG || true +sed -i .old "s/{AUTO_ONLINE}/$DAP_AUTO_ONLINE/g" $DAP_CFG || true +sed -i .old "s/{SERVER_ENABLED}/$DAP_SERVER_ENABLED/g" $DAP_CFG || true +sed -i .old "s/{SERVER_PORT}/$DAP_SERVER_PORT/g" $DAP_CFG || true +sed -i .old "s/{SERVER_ADDR}/$DAP_SERVER_ADDR/g" $DAP_CFG || true +sed -i .old "s/{PREFIX}/$DAP_PREFIX_TPL/g" $DAP_CFG || true rm $DAP_CFG.old # Init chains diff --git a/sources/exh_win32.c b/sources/exh_win32.c index d01c401a0d61ca2f453cd1d9ab01972d5e3ecfa2..330cb834d24981484e9dbe1c22ef018c61fc7668 100644 --- a/sources/exh_win32.c +++ b/sources/exh_win32.c @@ -4,10 +4,11 @@ #include <stdint.h> #include <string.h> #include <stdbool.h> +#include <conio.h> #include "dap_common.h" -DWORD ExceptionFilter( EXCEPTION_POINTERS *ep ); +LONG ExceptionFilter( EXCEPTION_POINTERS *ep ); void S_SetExceptionFilter( void ) { @@ -33,7 +34,7 @@ typedef struct _EXCEPTION_RECORD { } EXCEPTION_RECORD; #endif -DWORD ExceptionFilter( EXCEPTION_POINTERS *ep ) +LONG ExceptionFilter( EXCEPTION_POINTERS *ep ) { // printf( "\r\nExceptionCode = 0x%0X[%s]\r\n", ep->ExceptionRecord->ExceptionCode, buff ); @@ -85,7 +86,7 @@ DWORD ExceptionFilter( EXCEPTION_POINTERS *ep ) HANDLE hConOut = GetStdHandle( STD_OUTPUT_HANDLE ); SetConsoleTextAttribute( hConOut, 12 ); - printf( "\r\nExceptionCode = 0x%0X[%s]\r\n", ep->ExceptionRecord->ExceptionCode, buff ); + printf( "\r\nExceptionCode = 0x%0lX[%s]\r\n", ep->ExceptionRecord->ExceptionCode, buff ); SetConsoleTextAttribute( hConOut, 7 ); diff --git a/sources/main.c b/sources/main.c index c3306c27227dafa654df44dab2272440742b4dcb..18bca55f563d1a09c0dfffb54c1fcad5ef85d67a 100755 --- a/sources/main.c +++ b/sources/main.c @@ -61,8 +61,10 @@ #include "dap_http_folder.h" #include "dap_chain_node_dns_client.h" #include "dap_chain_node_dns_server.h" -#include "dap_modules_dynamic_cdb.h" +#ifdef DAP_MODULES_DYNAMIC +#include "dap_modules_dynamic_cdb.h" +#endif #include "dap_events.h" #include "dap_enc.h" @@ -89,8 +91,6 @@ #ifdef DAP_OS_LINUX #include "dap_chain_net_srv_vpn.h" -#include "dap_chain_net_srv_vpn_cdb.h" -#include "dap_chain_net_srv_vpn_cdb_server_list.h" #include "dap_chain_net_vpn_client.h" #endif @@ -141,7 +141,7 @@ void exit_if_server_already_running( void ); static const char *s_pid_file_path = NULL; -bool dap_chain_net_srv_pay_verificator(dap_chain_tx_out_cond_t *a_cond, dap_chain_datum_tx_t *a_tx) { return true; } +bool dap_chain_net_srv_pay_verificator(dap_chain_tx_out_cond_t *a_cond, dap_chain_datum_tx_t *a_tx) { UNUSED(a_cond); UNUSED(a_tx); return true; } #ifdef __ANDROID__ int cellframe_node_Main(int argc, const char **argv) @@ -158,7 +158,6 @@ int main( int argc, const char **argv ) #if defined(_WIN32) && defined(NDEBUG) S_SetExceptionFilter( ); #endif - #ifdef _WIN32 g_sys_dir_path = dap_strdup_printf("%s/%s", regGetUsrPath(), dap_get_appname()); #elif DAP_OS_MAC @@ -426,6 +425,7 @@ int main( int argc, const char **argv ) // Init HTTP-specific values dap_http_new( l_server, dap_get_appname() ); +#ifdef DAP_MODULES_DYNAMIC if( dap_config_get_item_bool_default(g_config,"cdb","enabled",false) ) { if(dap_modules_dynamic_load_cdb(DAP_HTTP( l_server ))){ log_it(L_CRITICAL,"Can't init CDB module"); @@ -434,6 +434,7 @@ int main( int argc, const char **argv ) log_it(L_NOTICE, "Central DataBase (CDB) is initialized"); } } +#endif // Handshake URL enc_http_add_proc( DAP_HTTP(l_server), ENC_HTTP_URL ); @@ -470,13 +471,8 @@ int main( int argc, const char **argv ) } } - - - //dap_chain_net_load_all(); - - //Init python plugins #ifdef DAP_SUPPORT_PYTHON_PLUGINS log_it(L_NOTICE, "Loading python plugins"); @@ -490,9 +486,9 @@ int main( int argc, const char **argv ) //failure: - #ifdef DAP_SUPPORT_PYTHON_PLUGINS - dap_chain_plugins_deinit(); - #endif +// #ifdef DAP_SUPPORT_PYTHON_PLUGINS +// dap_chain_plugins_deinit(); +// #endif dap_dns_server_stop(); dap_stream_deinit(); dap_stream_ctl_deinit(); @@ -504,9 +500,13 @@ int main( int argc, const char **argv ) dap_chain_net_srv_xchange_deinit(); dap_chain_net_srv_stake_deinit(); dap_chain_net_deinit(); +#ifdef DAP_MODULES_DYNAMIC + dap_modules_dynamic_close_cdb(); +#endif dap_chain_global_db_deinit(); dap_chain_deinit(); dap_config_close( g_config ); + dap_interval_timer_deinit(); dap_common_deinit(); return rc * 10; @@ -577,8 +577,8 @@ void exit_if_server_already_running( void ) { #endif if ( (pid != 0 && is_process_running(pid)) || mf ) { - log_it( L_WARNING, "Proccess %d is running, don't allow " - "to run more than one copy of DapServer, exiting...", pid ); + log_it( L_WARNING, "Proccess %"DAP_UINT64_FORMAT_U" is running, don't allow " + "to run more than one copy of DapServer, exiting...", (uint64_t)pid ); exit( -2 ); } } diff --git a/sources/main_node_cli.c b/sources/main_node_cli.c index 862166989882e68a8b5d6c508b514d9c1ed5ed13..102a42625ff5b64f43e3443c47cbeb9d110484a5 100644 --- a/sources/main_node_cli.c +++ b/sources/main_node_cli.c @@ -27,11 +27,11 @@ #include <stdlib.h> #include <string.h> +#include "dap_chain_node_cli.h" //#include "dap_client.h" #include "dap_common.h" #include "dap_file_utils.h" #include "dap_strfuncs.h" -#include "dap_chain_node_cli.h" #include "dap_app_cli.h" #include "dap_app_cli_net.h" #include "dap_app_cli_shell.h" @@ -59,7 +59,7 @@ static char** split_word(char *line, int *argc) *argc = 0; return NULL ; } - char **argv = calloc(sizeof(char*), strlen(line)); + char **argv = DAP_NEW_Z_SIZE(char*, sizeof(char*) * strlen(line)); int n = 0; char *s, *start = line; size_t len = strlen(line); @@ -131,9 +131,11 @@ int execute_line(char *line) cmd.cmd_param = (char**) (argv + 1); // Send command int res = dap_app_cli_post_command(cparam, &cmd); + DAP_DELETE(argv); return res; } fprintf(stderr, "No command\n"); + DAP_DELETE(argv); return -1; //((*(command->func))(argc, (const char **) argv, NULL)); } @@ -199,7 +201,14 @@ int main(int argc, const char *argv[]) SetConsoleOutputCP(1252); g_sys_dir_path = dap_strdup_printf("%s/%s", regGetUsrPath(), dap_get_appname()); #elif DAP_OS_MAC - g_sys_dir_path = dap_strdup_printf("/Applications/%s.app/Contents/Resources", dap_get_appname()); + char * l_username = NULL; + exec_with_ret(&l_username,"whoami|tr -d '\n'"); + if (!l_username){ + printf("Fatal Error: Can't obtain username"); + return 2; + } + g_sys_dir_path = dap_strdup_printf("/Users/%s/Applications/Cellframe.app/Contents/Resources", l_username); + DAP_DELETE(l_username); #elif DAP_OS_ANDROID g_sys_dir_path = dap_strdup_printf("/storage/emulated/0/opt/%s",dap_get_appname()); #elif DAP_OS_UNIX diff --git a/sources/main_node_tool.c b/sources/main_node_tool.c index 7d0738de194bd9d3c0d8da6f68bcadb6900a5af9..5547c419e961529323168205e8aa1459813f0f30 100644 --- a/sources/main_node_tool.c +++ b/sources/main_node_tool.c @@ -99,14 +99,16 @@ #endif #undef log_it +#ifdef DAP_OS_WINDOWS +#define log_it(_log_level, string, ...) __mingw_printf(string, ##__VA_ARGS__) +#else #define log_it(_log_level, string, ...) printf(string, ##__VA_ARGS__) +#endif static int s_init( int argc, const char * argv[] ); static void s_help( ); static char s_system_ca_dir[MAX_PATH]; -static char * s_config_dir = NULL; -static char * s_log_file_path= NULL; #ifdef __ANDROID__ int cellframe_node_tool_Main(int argc, const char **argv) @@ -185,7 +187,7 @@ int main(int argc, const char **argv) if ( l_data_file ) {} } else { - log_it( L_ERROR, "Cert index %d can't be found in wallet with %lu certs inside" + log_it( L_ERROR, "Cert index %d can't be found in wallet with %zu certs inside" ,l_cert_index,l_wallet_certs_number ); s_help(); exit( -3002 ); @@ -376,12 +378,21 @@ int main(int argc, const char **argv) */ static int s_init( int argc, const char **argv ) { + UNUSED(argc); + UNUSED(argv); dap_set_appname("cellframe-node"); #ifdef _WIN32 g_sys_dir_path = dap_strdup_printf("%s/%s", regGetUsrPath(), dap_get_appname()); char * s_log_dir_path = dap_strdup_printf("%s/var/log", g_sys_dir_path) ; #elif DAP_OS_MAC - g_sys_dir_path = dap_strdup_printf("/Applications/%s.app/Contents/Resources", dap_get_appname()); + char * l_username = NULL; + exec_with_ret(&l_username,"whoami|tr -d '\n'"); + if (!l_username){ + printf("Fatal Error: Can't obtain username"); + return 2; + } + g_sys_dir_path = dap_strdup_printf("/Users/%s/Applications/Cellframe.app/Contents/Resources", l_username); + DAP_DELETE(l_username); char * s_log_dir_path = dap_strdup_printf("/Library/%s.app/Logs", dap_get_appname() ) ; #elif DAP_OS_ANDROID g_sys_dir_path = dap_strdup_printf("/storage/emulated/0/opt/%s",dap_get_appname()); diff --git a/sources/sig_unix_handler.c b/sources/sig_unix_handler.c index c91be1133e1a7e714d606761d59caf7c6d42f605..97596560f8e45e61272ebcec1bb774e5ce95632a 100644 --- a/sources/sig_unix_handler.c +++ b/sources/sig_unix_handler.c @@ -1,6 +1,7 @@ #include <signal.h> #include <stdio.h> #include <string.h> +#include <unistd.h> #include "dap_common.h" #include "dap_events.h" @@ -16,9 +17,14 @@ #include "dap_http.h" #include "dap_chain_node_dns_server.h" #include "sig_unix_handler.h" +#ifdef DAP_MODULES_DYNAMIC +#include "dap_modules_dynamic_cdb.h" +#endif #define LOG_TAG "sig_unix_handler" +void dap_chain_plugins_deinit(); + static const char *s_pid_path = NULL; static void clear_pid_file() { @@ -31,10 +37,10 @@ static void clear_pid_file() { static void sig_exit_handler(int sig_code) { log_it(L_DEBUG, "Got exit code: %d", sig_code); - + clear_pid_file(); - #ifdef DAP_SUPPORT_PYTHON_PLUGINS +#ifdef DAP_SUPPORT_PYTHON_PLUGINS dap_chain_plugins_deinit(); #endif dap_chain_node_mempool_autoproc_deinit(); @@ -48,11 +54,10 @@ static void sig_exit_handler(int sig_code) { dap_enc_ks_deinit(); enc_http_deinit(); dap_http_deinit(); - dap_dns_server_stop(); - dap_server_deinit(); - dap_events_stop_all(); - dap_events_deinit(); - dap_config_close( g_config ); +#ifdef DAP_MODULES_DYNAMIC + dap_modules_dynamic_close_cdb(); +#endif + dap_interval_timer_deinit(); dap_common_deinit(); log_it(L_NOTICE,"Stopped Cellframe Node");