Merge pull request #4411

e03402b0 wallet_rpc_server: fix build for windows (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-09-21 20:51:39 +02:00
commit 7aa5112280
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
1 changed files with 17 additions and 8 deletions

View File

@ -3294,9 +3294,12 @@ class t_daemon
private: private:
const boost::program_options::variables_map& vm; const boost::program_options::variables_map& vm;
std::unique_ptr<tools::wallet_rpc_server> wrpc;
public: public:
t_daemon(boost::program_options::variables_map const & _vm) t_daemon(boost::program_options::variables_map const & _vm)
: vm(_vm) : vm(_vm)
, wrpc(new tools::wallet_rpc_server)
{ {
} }
@ -3386,17 +3389,16 @@ public:
return false; return false;
} }
just_dir: just_dir:
tools::wallet_rpc_server wrpc; if (wal) wrpc->set_wallet(wal.release());
if (wal) wrpc.set_wallet(wal.release()); bool r = wrpc->init(&vm);
bool r = wrpc.init(&vm);
CHECK_AND_ASSERT_MES(r, false, tools::wallet_rpc_server::tr("Failed to initialize wallet RPC server")); CHECK_AND_ASSERT_MES(r, false, tools::wallet_rpc_server::tr("Failed to initialize wallet RPC server"));
tools::signal_handler::install([&wrpc](int) { tools::signal_handler::install([this](int) {
wrpc.send_stop_signal(); wrpc->send_stop_signal();
}); });
LOG_PRINT_L0(tools::wallet_rpc_server::tr("Starting wallet RPC server")); LOG_PRINT_L0(tools::wallet_rpc_server::tr("Starting wallet RPC server"));
try try
{ {
wrpc.run(); wrpc->run();
} }
catch (const std::exception &e) catch (const std::exception &e)
{ {
@ -3407,7 +3409,7 @@ public:
try try
{ {
LOG_PRINT_L0(tools::wallet_rpc_server::tr("Saving wallet...")); LOG_PRINT_L0(tools::wallet_rpc_server::tr("Saving wallet..."));
wrpc.stop(); wrpc->stop();
LOG_PRINT_L0(tools::wallet_rpc_server::tr("Successfully saved")); LOG_PRINT_L0(tools::wallet_rpc_server::tr("Successfully saved"));
} }
catch (const std::exception& e) catch (const std::exception& e)
@ -3417,6 +3419,11 @@ public:
} }
return true; return true;
} }
void stop()
{
wrpc->send_stop_signal();
}
}; };
class t_executor final class t_executor final
@ -3424,7 +3431,9 @@ class t_executor final
public: public:
static std::string const NAME; static std::string const NAME;
std::string const & name() typedef ::t_daemon t_daemon;
std::string const & name() const
{ {
return NAME; return NAME;
} }