diff --git a/CMakeLists.txt b/CMakeLists.txt index 64e7ee0878b4bca1a2fbf822ee9d90d080378245..b77e78498929b1eb984fc795786291252f00d619 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,8 +7,8 @@ set(CMAKE_C_STANDARD 11) # Predefine project SET( CPACK_PACKAGE_NAME "${PROJECT_NAME}") SET( CPACK_PACKAGE_VERSION_MAJOR 4) -SET( CPACK_PACKAGE_VERSION_MINOR 0) -SET( CPACK_PACKAGE_VERSION_PATCH 49) +SET( CPACK_PACKAGE_VERSION_MINOR 1) +SET( CPACK_PACKAGE_VERSION_PATCH 21) # init CellFrame SDK add_definitions("-DDAP_VERSION=\"${CPACK_PACKAGE_VERSION_MAJOR}-${CPACK_PACKAGE_VERSION_MINOR}-${CPACK_PACKAGE_VERSION_PATCH}\"") diff --git a/cellframe-sdk b/cellframe-sdk index 21886ef54e5b6d00c605221271530f83201b1574..0eb1f5b61d256c857ad60571392c171a3cbe0baf 160000 --- a/cellframe-sdk +++ b/cellframe-sdk @@ -1 +1 @@ -Subproject commit 21886ef54e5b6d00c605221271530f83201b1574 +Subproject commit 0eb1f5b61d256c857ad60571392c171a3cbe0baf diff --git a/python-cellframe b/python-cellframe index 9f688d245a213efe62908045611494b09916e647..25c1913eb6224a3eb7592438a977365501593a6f 160000 --- a/python-cellframe +++ b/python-cellframe @@ -1 +1 @@ -Subproject commit 9f688d245a213efe62908045611494b09916e647 +Subproject commit 25c1913eb6224a3eb7592438a977365501593a6f diff --git a/sources/main.c b/sources/main.c index f475c22bd0a35403a9951a592cb35e777aad702c..b257d201cf779e1c21096844d726350ee39184b1 100755 --- a/sources/main.c +++ b/sources/main.c @@ -1,9 +1,9 @@ /* * Authors: * Dmitriy A. Gerasimov <kahovski@gmail.com> - * DeM Labs Inc. https://demlabs.net - * DeM Labs Open source community https://github.com/demlabsinc - * Copyright (c) 2017-2019 + * DeM Labs Ltd. https://demlabs.net + * DapCash https://dapcash.org + * Copyright (c) 2017-2020 * All rights reserved. This file is part of DAP (Deus Applications Prototypes) the open source project @@ -164,11 +164,10 @@ int main( int argc, const char **argv ) #endif { - char l_log_path[MAX_PATH] = {'\0'}; - int l_pos = dap_sprintf(l_log_path, "%s/var/log", g_sys_dir_path); - dap_mkdir_with_parents(l_log_path); - dap_sprintf(l_log_path + l_pos, "/%s.log", dap_get_appname()); - if (dap_common_init(dap_get_appname(), l_log_path) != 0) { + char *l_log_dir = dap_strdup_printf("%s/var/log", g_sys_dir_path); + dap_mkdir_with_parents(l_log_dir); + char * l_log_file = dap_strdup_printf( "%s/%s.log", l_log_dir, dap_get_appname()); + if (dap_common_init(dap_get_appname(), l_log_file, l_log_dir) != 0) { printf("Fatal Error: Can't init common functions module"); return -2; } @@ -190,7 +189,7 @@ int main( int argc, const char **argv ) log_it(L_DEBUG, "Parsing command line args"); parse_args( argc, argv ); #ifdef _WIN32 - CreateMutexW( NULL, FALSE, (WCHAR *) L"DAPCASH_NODE_74E9201D33F7F7F684D2FEF1982799A79B6BF94B568446A8D1DE947B00E3C75060F3FD5BF277592D02F77D7E50935E56" ); + CreateMutexW( NULL, FALSE, (WCHAR *) L"DAP_CELLFRAME_NODE_74E9201D33F7F7F684D2FEF1982799A79B6BF94B568446A8D1DE947B00E3C75060F3FD5BF277592D02F77D7E50935E56" ); #endif l_debug_mode = dap_config_get_item_bool_default( g_config,"general","debug_mode", false ); @@ -394,8 +393,7 @@ int main( int argc, const char **argv ) if( l_port > 0 ) { l_server = dap_server_new(l_events, (dap_config_get_item_str(g_config, "server", "listen_address")), - (uint16_t) l_port, - DAP_SERVER_TCP ); + (uint16_t) l_port, DAP_SERVER_TCP, NULL ); } else log_it( L_WARNING, "Server is enabled but no port is defined" ); @@ -441,12 +439,14 @@ int main( int argc, const char **argv ) } else log_it( L_INFO, "No enabled server, working in client mode only" ); - - // DNS server start - bool bootstrap_balancer_enabled = dap_config_get_item_bool_default(g_config, "dns_server", "bootstrap_balancer", false); - log_it(L_DEBUG, "config dns_server->bootstrap_balancer = \"%u\" ", bootstrap_balancer_enabled); - if (bootstrap_balancer_enabled) { - dap_dns_server_start(); + if (dap_config_get_item_bool_default(g_config, "dns_server", "enabled", false)) + { + // DNS server start + bool bootstrap_balancer_enabled = dap_config_get_item_bool_default(g_config, "dns_server", "bootstrap_balancer", false); + log_it(L_DEBUG, "config dns_server->bootstrap_balancer = \"%u\" ", bootstrap_balancer_enabled); + if (bootstrap_balancer_enabled) { + dap_dns_server_start(l_events, dap_config_get_item_uint16_default(g_config, "dns_server", "bootstrap_balancer_port", DNS_LISTEN_PORT)); + } } // Chain Network init @@ -495,7 +495,9 @@ int main( int argc, const char **argv ) dap_chain_node_mempool_autoproc_deinit(); dap_chain_net_srv_xchange_deinit(); dap_chain_net_srv_stake_deinit(); - + dap_chain_net_deinit(); + dap_chain_global_db_deinit(); + dap_chain_deinit(); dap_config_close( g_config ); dap_common_deinit(); @@ -559,7 +561,7 @@ void exit_if_server_already_running( void ) { bool mf = false; #ifdef _WIN32 - CreateMutexW( NULL, FALSE, (WCHAR *) L"DAPCASH_NODE_74E9201D33F7F7F684D2FEF1982799A79B6BF94B568446A8D1DE947B00E3C75060F3FD5BF277592D02F77D7E50935E56" ); + CreateMutexW( NULL, FALSE, (WCHAR *) L"DAP_CELLFRAME_NODE_74E9201D33F7F7F684D2FEF1982799A79B6BF94B568446A8D1DE947B00E3C75060F3FD5BF277592D02F77D7E50935E56" ); if ( GetLastError( ) == 183 ) { mf = true; diff --git a/sources/main_node_cli.c b/sources/main_node_cli.c index 2067942928e849683993bf876b38d629c0f3c6db..2f2c60154e57050180ec38235d4e3595fe23c1e0 100644 --- a/sources/main_node_cli.c +++ b/sources/main_node_cli.c @@ -204,7 +204,7 @@ int main(int argc, const char *argv[]) #elif DAP_OS_UNIX g_sys_dir_path = dap_strdup_printf("/opt/%s", dap_get_appname()); #endif - if (dap_common_init(dap_get_appname(), NULL) != 0) { + if (dap_common_init(dap_get_appname(), NULL, NULL) != 0) { printf("Fatal Error: Can't init common functions module"); return -2; } diff --git a/sources/main_node_tool.c b/sources/main_node_tool.c index 01185f26bea5a8b383561ba193227d4e28e9fe68..3d21d959c0297fbf27e73c5e03067f1ecc0d517e 100644 --- a/sources/main_node_tool.c +++ b/sources/main_node_tool.c @@ -377,17 +377,21 @@ int main(int argc, const char **argv) static int s_init( int argc, const char **argv ) { dap_set_appname("dapcash-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 * 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()); + char * s_log_dir_path = dap_strdup_printf("%s/var/log", g_sys_dir_path) ; #elif DAP_OS_UNIX g_sys_dir_path = dap_strdup_printf("/opt/%s", dap_get_appname()); + char * s_log_dir_path = dap_strdup_printf("%s/var/log", g_sys_dir_path) ; #endif - if (dap_common_init(dap_get_appname(), NULL) != 0) { + char * s_log_file_path = dap_strdup_printf("%s/%s.log",s_log_dir_path, dap_get_appname()); + if (dap_common_init(dap_get_appname(), s_log_file_path, s_log_dir_path ) != 0) { printf("Fatal Error: Can't init common functions module"); return -2; }