aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet_rpc_server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/wallet_rpc_server.cpp')
-rw-r--r--src/wallet/wallet_rpc_server.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index a1f48bd77..0c1ea48c1 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -57,6 +57,7 @@ namespace tools
//------------------------------------------------------------------------------------------------------------------------------
bool wallet_rpc_server::run()
{
+ m_stop = false;
m_net_server.add_idle_handler([this](){
try {
m_wallet.refresh();
@@ -65,6 +66,14 @@ namespace tools
}
return true;
}, 20000);
+ m_net_server.add_idle_handler([this](){
+ if (m_stop.load(std::memory_order_relaxed))
+ {
+ send_stop_signal();
+ return false;
+ }
+ return true;
+ }, 500);
//DO NOT START THIS SERVER IN MORE THEN 1 THREADS WITHOUT REFACTORING
return epee::http_server_impl_base<wallet_rpc_server, connection_context>::run(1, true);
@@ -605,11 +614,6 @@ namespace tools
}
}
- if (!transfers_found)
- {
- return false;
- }
-
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
@@ -653,8 +657,8 @@ namespace tools
try
{
- send_stop_signal();
m_wallet.store();
+ m_stop.store(true, std::memory_order_relaxed);
}
catch (std::exception& e)
{