aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/daemon.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2015-03-30 12:58:22 +0200
committerRiccardo Spagni <ric@spagni.net>2015-03-30 13:02:02 +0200
commitb0151de60144ddc1f56d253e7574bd6a9aefa28f (patch)
tree4e87da719ff11ccfa61798f3bd07d42574cc9c22 /src/daemon/daemon.cpp
parentMerge pull request #247 (diff)
parentRestore daemon interactive mode (diff)
downloadmonero-b0151de60144ddc1f56d253e7574bd6a9aefa28f.tar.xz
Merge pull request #248
a0590d2 Restore daemon interactive mode (Thomas Winget)
Diffstat (limited to '')
-rw-r--r--src/daemon/daemon.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp
index 728b239a0..ec12c281c 100644
--- a/src/daemon/daemon.cpp
+++ b/src/daemon/daemon.cpp
@@ -35,6 +35,7 @@
#include "daemon/p2p.h"
#include "daemon/protocol.h"
#include "daemon/rpc.h"
+#include "daemon/command_server.h"
#include "misc_log_ex.h"
#include "version.h"
#include <boost/program_options.hpp>
@@ -101,7 +102,7 @@ t_daemon & t_daemon::operator=(t_daemon && other)
return *this;
}
-bool t_daemon::run()
+bool t_daemon::run(bool interactive)
{
if (nullptr == mp_internals)
{
@@ -113,7 +114,22 @@ bool t_daemon::run()
{
mp_internals->core.run();
mp_internals->rpc.run();
- mp_internals->p2p.run();
+
+ daemonize::t_command_server* rpc_commands;
+
+ if (interactive)
+ {
+ rpc_commands = new daemonize::t_command_server(0, 0, false, mp_internals->rpc.get_server());
+ rpc_commands->start_handling();
+ }
+
+ mp_internals->p2p.run(); // blocks until p2p goes down
+
+ if (interactive)
+ {
+ rpc_commands->stop_handling();
+ }
+
mp_internals->rpc.stop();
LOG_PRINT("Node stopped.", LOG_LEVEL_0);
return true;