mirror of
https://codeberg.org/wownero/wownero-lws
synced 2026-01-09 23:25:16 -08:00
Fixing shutdown request during sync-phase (#143)
This commit is contained in:
committed by
Lee *!* Clagett
parent
075dc5d7c2
commit
ed6fde7f28
@@ -1069,7 +1069,7 @@ namespace lws
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename R, typename Q>
|
template<typename R, typename Q>
|
||||||
expect<typename R::response> fetch_chain(const scanner_sync& self, rpc::client& client, const char* endpoint, const Q& req)
|
expect<typename R::response> fetch_chain(scanner_sync& self, rpc::client& client, const char* endpoint, const Q& req)
|
||||||
{
|
{
|
||||||
expect<void> sent{lws::error::daemon_timeout};
|
expect<void> sent{lws::error::daemon_timeout};
|
||||||
|
|
||||||
@@ -1078,6 +1078,9 @@ namespace lws
|
|||||||
|
|
||||||
while (!(sent = client.send(std::move(msg), std::chrono::seconds{1})))
|
while (!(sent = client.send(std::move(msg), std::chrono::seconds{1})))
|
||||||
{
|
{
|
||||||
|
// Run possible SIGINT handler
|
||||||
|
self.io_.poll_one();
|
||||||
|
self.io_.reset();
|
||||||
if (self.has_shutdown())
|
if (self.has_shutdown())
|
||||||
return {lws::error::signal_abort_process};
|
return {lws::error::signal_abort_process};
|
||||||
|
|
||||||
@@ -1093,6 +1096,9 @@ namespace lws
|
|||||||
|
|
||||||
while (!(resp = client.get_message(std::chrono::seconds{1})))
|
while (!(resp = client.get_message(std::chrono::seconds{1})))
|
||||||
{
|
{
|
||||||
|
// Run possible SIGINT handler
|
||||||
|
self.io_.poll_one();
|
||||||
|
self.io_.reset();
|
||||||
if (self.has_shutdown())
|
if (self.has_shutdown())
|
||||||
return {lws::error::signal_abort_process};
|
return {lws::error::signal_abort_process};
|
||||||
|
|
||||||
@@ -1106,7 +1112,7 @@ namespace lws
|
|||||||
}
|
}
|
||||||
|
|
||||||
// does not validate blockchain hashes
|
// does not validate blockchain hashes
|
||||||
expect<rpc::client> sync_quick(const scanner_sync& self, db::storage disk, rpc::client client)
|
expect<rpc::client> sync_quick(scanner_sync& self, db::storage disk, rpc::client client)
|
||||||
{
|
{
|
||||||
MINFO("Starting blockchain sync with daemon");
|
MINFO("Starting blockchain sync with daemon");
|
||||||
|
|
||||||
@@ -1145,7 +1151,7 @@ namespace lws
|
|||||||
}
|
}
|
||||||
|
|
||||||
// validates blockchain hashes
|
// validates blockchain hashes
|
||||||
expect<rpc::client> sync_full(const scanner_sync& self, db::storage disk, rpc::client client)
|
expect<rpc::client> sync_full(scanner_sync& self, db::storage disk, rpc::client client)
|
||||||
{
|
{
|
||||||
MINFO("Starting blockchain sync with daemon");
|
MINFO("Starting blockchain sync with daemon");
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,10 @@ namespace lws
|
|||||||
void shutdown() { shutdown_ = true; stop(); }
|
void shutdown() { shutdown_ = true; stop(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Scans all active `db::account`s. Detects if another process changes active list.
|
/*! Scans all active `db::account`s. Detects if another process changes
|
||||||
|
active list.
|
||||||
|
|
||||||
|
\note Everything except `sync` and `run` is thread-safe. */
|
||||||
class scanner
|
class scanner
|
||||||
{
|
{
|
||||||
db::storage disk_;
|
db::storage disk_;
|
||||||
|
|||||||
Reference in New Issue
Block a user