diff --git a/src/common/command_line.cpp b/src/common/command_line.cpp index 73178ce8..0aefbc17 100644 --- a/src/common/command_line.cpp +++ b/src/common/command_line.cpp @@ -25,5 +25,7 @@ namespace command_line const arg_descriptor arg_show_details = { "currency-details", "Display currency details" }; const arg_descriptor arg_show_rpc_autodoc = { "show_rpc_autodoc", "Display rpc auto-generated documentation template" }; - const arg_descriptor arg_disable_upnp = { "disable-upnp", "Disable UPnP (enhances local network privacy)", false, true }; + const arg_descriptor arg_disable_upnp = { "disable-upnp", "Disable UPnP (enhances local network privacy)", false, true }; + + const arg_descriptor arg_disable_stop_if_time_out_of_sync = { "disable-stop-if-time-out-of-sync", "Do not stop the daemon if serious time synchronization problem is detected", false, true }; } diff --git a/src/common/command_line.h b/src/common/command_line.h index e4a9c544..2dff6a3d 100644 --- a/src/common/command_line.h +++ b/src/common/command_line.h @@ -185,4 +185,5 @@ namespace command_line extern const arg_descriptor arg_show_details; extern const arg_descriptor arg_show_rpc_autodoc; extern const arg_descriptor arg_disable_upnp; + extern const arg_descriptor arg_disable_stop_if_time_out_of_sync; } diff --git a/src/currency_protocol/currency_protocol_handler.inl b/src/currency_protocol/currency_protocol_handler.inl index 990cf163..6ba18e43 100644 --- a/src/currency_protocol/currency_protocol_handler.inl +++ b/src/currency_protocol/currency_protocol_handler.inl @@ -131,11 +131,12 @@ namespace currency if (!add_time_delta_and_check_time_sync(context.m_time_delta)) { // serious time sync problem detected - std::shared_ptr ish(m_core.get_stop_handler()); + i_stop_handler* ish(m_core.get_stop_handler()); if (ish != nullptr) { - // this is a daemon -- stop immediately + // this is daemon -- stop immediately ish->stop_handling(); + LOG_ERROR(ENDL << ENDL << "Serious time sync problem detected, daemon will stop immediately" << ENDL << ENDL); return true; } } diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp index a9ddf296..2e15932e 100644 --- a/src/daemon/daemon.cpp +++ b/src/daemon/daemon.cpp @@ -81,6 +81,7 @@ int main(int argc, char* argv[]) command_line::add_arg(desc_cmd_sett, command_line::arg_console); command_line::add_arg(desc_cmd_sett, command_line::arg_show_details); command_line::add_arg(desc_cmd_sett, command_line::arg_show_rpc_autodoc); + command_line::add_arg(desc_cmd_sett, command_line::arg_disable_stop_if_time_out_of_sync); arg_market_disable.default_value = true; @@ -167,7 +168,10 @@ int main(int argc, char* argv[]) cprotocol.set_p2p_endpoint(&p2psrv); ccore.set_currency_protocol(&cprotocol); daemon_cmmands_handler dch(p2psrv, rpc_server); - ccore.set_stop_handler(&dch); + + if (!command_line::get_arg(vm, command_line::arg_disable_stop_if_time_out_of_sync)) + ccore.set_stop_handler(&dch); + //ccore.get_blockchain_storage().get_attachment_services_manager().add_service(&offers_service); std::shared_ptr stratum_server_ptr; if (stratum_enabled) @@ -305,7 +309,7 @@ int main(int argc, char* argv[]) LOG_PRINT_L0("Deinitializing p2p..."); p2psrv.deinit(); - + ccore.set_stop_handler(nullptr); ccore.set_currency_protocol(NULL); cprotocol.set_p2p_endpoint(NULL);