aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-10-15 13:49:05 +0200
committerRiccardo Spagni <ric@spagni.net>2018-10-15 13:49:05 +0200
commit92f42b1e81223e51378c743b6b7c7b8cce88edf6 (patch)
tree2d3baa0a1002bf70d821d7725bf66b28e1b657b9 /src
parentMerge pull request #4568 (diff)
parentdaemon: do not run complex code in a signal handler (diff)
downloadmonero-92f42b1e81223e51378c743b6b7c7b8cce88edf6.tar.xz
Merge pull request #4570
3b04e2e3 daemon: do not run complex code in a signal handler (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r--src/daemon/daemon.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp
index ea24e32eb..f53649518 100644
--- a/src/daemon/daemon.cpp
+++ b/src/daemon/daemon.cpp
@@ -136,7 +136,14 @@ bool t_daemon::run(bool interactive)
{
throw std::runtime_error{"Can't run stopped daemon"};
}
- tools::signal_handler::install(std::bind(&daemonize::t_daemon::stop_p2p, this));
+
+ std::atomic<bool> stop(false);
+ boost::thread([&stop, this] {
+ while (!stop)
+ epee::misc_utils::sleep_no_w(100);
+ this->stop_p2p();
+ }).detach();
+ tools::signal_handler::install([&stop](int){ stop = true; });
try
{