mirror of
https://github.com/vtnerd/monero-lws.git
synced 2024-11-16 17:27:39 +00:00
Fixing shutdown request during sync-phase (#143)
Some checks are pending
unix-ci / build-tests (macos-12, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (macos-12, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (macos-13, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (macos-13, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (macos-latest, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (macos-latest, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (ubuntu-20.04, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (ubuntu-20.04, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (ubuntu-22.04, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (ubuntu-22.04, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (ubuntu-latest, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (ubuntu-latest, WITH_RMQ=ON) (push) Waiting to run
Some checks are pending
unix-ci / build-tests (macos-12, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (macos-12, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (macos-13, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (macos-13, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (macos-latest, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (macos-latest, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (ubuntu-20.04, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (ubuntu-20.04, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (ubuntu-22.04, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (ubuntu-22.04, WITH_RMQ=ON) (push) Waiting to run
unix-ci / build-tests (ubuntu-latest, WITH_RMQ=OFF) (push) Waiting to run
unix-ci / build-tests (ubuntu-latest, WITH_RMQ=ON) (push) Waiting to run
This commit is contained in:
parent
a81d71ae29
commit
c21a56f8b3
2 changed files with 13 additions and 4 deletions
|
@ -1064,7 +1064,7 @@ namespace lws
|
|||
}
|
||||
|
||||
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};
|
||||
|
||||
|
@ -1073,6 +1073,9 @@ namespace lws
|
|||
|
||||
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())
|
||||
return {lws::error::signal_abort_process};
|
||||
|
||||
|
@ -1088,6 +1091,9 @@ namespace lws
|
|||
|
||||
while (!(resp = client.get_message(std::chrono::seconds{1})))
|
||||
{
|
||||
// Run possible SIGINT handler
|
||||
self.io_.poll_one();
|
||||
self.io_.reset();
|
||||
if (self.has_shutdown())
|
||||
return {lws::error::signal_abort_process};
|
||||
|
||||
|
@ -1101,7 +1107,7 @@ namespace lws
|
|||
}
|
||||
|
||||
// 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");
|
||||
|
||||
|
@ -1140,7 +1146,7 @@ namespace lws
|
|||
}
|
||||
|
||||
// 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");
|
||||
|
||||
|
|
|
@ -91,7 +91,10 @@ namespace lws
|
|||
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
|
||||
{
|
||||
db::storage disk_;
|
||||
|
|
Loading…
Reference in a new issue