1
0
Fork 0
forked from lthn/blockchain

time sync issues detection: --disable-stop-if-time-out-of-sync option added + various fixes

This commit is contained in:
sowle 2019-06-07 15:15:14 +03:00
parent be51d8ecd7
commit 403f21130b
4 changed files with 13 additions and 5 deletions

View file

@ -25,5 +25,7 @@ namespace command_line
const arg_descriptor<bool> arg_show_details = { "currency-details", "Display currency details" };
const arg_descriptor<bool> arg_show_rpc_autodoc = { "show_rpc_autodoc", "Display rpc auto-generated documentation template" };
const arg_descriptor<bool> arg_disable_upnp = { "disable-upnp", "Disable UPnP (enhances local network privacy)", false, true };
const arg_descriptor<bool> arg_disable_upnp = { "disable-upnp", "Disable UPnP (enhances local network privacy)", false, true };
const arg_descriptor<bool> 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 };
}

View file

@ -185,4 +185,5 @@ namespace command_line
extern const arg_descriptor<bool> arg_show_details;
extern const arg_descriptor<bool> arg_show_rpc_autodoc;
extern const arg_descriptor<bool> arg_disable_upnp;
extern const arg_descriptor<bool> arg_disable_stop_if_time_out_of_sync;
}

View file

@ -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<i_stop_handler> 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;
}
}

View file

@ -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<currency::stratum_server> 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);