diff options
author | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-06-11 07:40:14 +0200 |
---|---|---|
committer | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-06-12 07:21:03 +0200 |
commit | 9247134eaba9a1d0fa74f22de238af1476663005 (patch) | |
tree | 50a54aae174152f5a27f48c923d2124937331f43 /src/bitcoinrpc.cpp | |
parent | 883a310904b3d36c9d74b887d47c14a072ebae7d (diff) |
introduce a new StartShutdown() function, which starts a thread with Shutdown() if no GUI is used and calls uiInterface.QueueShutdown() if a GUI is used / all direct uiInterface.QueueShutdown() calls are replaced with Shutdown() - this ensures a clean GUI shutdown, even when catching a SIGTERM and allows the BitcoinGUI destructor to get called (which fixes a tray-icon issue and keeps the tray-icon until Bitcoin-Qt exits)
Diffstat (limited to 'src/bitcoinrpc.cpp')
-rw-r--r-- | src/bitcoinrpc.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 999c6dda09..8c3a615fd1 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -20,7 +20,7 @@ #include <boost/iostreams/stream.hpp> #include <boost/algorithm/string.hpp> #include <boost/lexical_cast.hpp> -#include <boost/asio/ssl.hpp> +#include <boost/asio/ssl.hpp> #include <boost/filesystem/fstream.hpp> typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SSLStream; @@ -436,7 +436,7 @@ Value stop(const Array& params, bool fHelp) "stop\n" "Stop Bitcoin server."); // Shutdown will take long enough that the response should get back - uiInterface.QueueShutdown(); + StartShutdown(); return "Bitcoin server stopping"; } @@ -1148,7 +1148,7 @@ Value sendmany(const Array& params, bool fHelp) CScript scriptPubKey; scriptPubKey.SetDestination(address.Get()); - int64 nAmount = AmountFromValue(s.value_); + int64 nAmount = AmountFromValue(s.value_); totalAmount += nAmount; vecSend.push_back(make_pair(scriptPubKey, nAmount)); @@ -1524,7 +1524,7 @@ Value listtransactions(const Array& params, bool fHelp) if ((int)ret.size() >= (nCount+nFrom)) break; } // ret is newest to oldest - + if (nFrom > (int)ret.size()) nFrom = ret.size(); if ((nFrom + nCount) > (int)ret.size()) @@ -1935,7 +1935,7 @@ Value encryptwallet(const Array& params, bool fHelp) // BDB seems to have a bad habit of writing old data into // slack space in .dat files; that is bad if the old data is // unencrypted private keys. So: - uiInterface.QueueShutdown(); + StartShutdown(); return "wallet encrypted; Bitcoin server stopping, restart to run with encrypted wallet"; } @@ -2682,7 +2682,7 @@ void ThreadRPCServer2(void* parg) GetConfigFile().string().c_str(), EncodeBase58(&rand_pwd[0],&rand_pwd[0]+32).c_str()), _("Error"), CClientUIInterface::OK | CClientUIInterface::MODAL); - uiInterface.QueueShutdown(); + StartShutdown(); return; } @@ -2703,7 +2703,7 @@ void ThreadRPCServer2(void* parg) { uiInterface.ThreadSafeMessageBox(strprintf(_("An error occured while setting up the RPC port %i for listening: %s"), endpoint.port(), e.what()), _("Error"), CClientUIInterface::OK | CClientUIInterface::MODAL); - uiInterface.QueueShutdown(); + StartShutdown(); return; } |