Changeset View
Changeset View
Standalone View
Standalone View
src/qt/bitcoin.cpp
Show All 23 Lines | |||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
#include "paymentserver.h" | #include "paymentserver.h" | ||||
#include "walletmodel.h" | #include "walletmodel.h" | ||||
#endif | #endif | ||||
#include "init.h" | #include "init.h" | ||||
#include "rpc/server.h" | #include "rpc/server.h" | ||||
#include "scheduler.h" | |||||
#include "ui_interface.h" | #include "ui_interface.h" | ||||
#include "uint256.h" | #include "uint256.h" | ||||
#include "util.h" | #include "util.h" | ||||
#include "warnings.h" | #include "warnings.h" | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
#include "wallet/init.h" | #include "wallet/init.h" | ||||
#include "wallet/wallet.h" | #include "wallet/wallet.h" | ||||
▲ Show 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | public Q_SLOTS: | ||||
void shutdown(); | void shutdown(); | ||||
Q_SIGNALS: | Q_SIGNALS: | ||||
void initializeResult(bool success); | void initializeResult(bool success); | ||||
void shutdownResult(); | void shutdownResult(); | ||||
void runawayException(const QString &message); | void runawayException(const QString &message); | ||||
private: | private: | ||||
boost::thread_group threadGroup; | |||||
CScheduler scheduler; | |||||
/// Pass fatal exception message to UI thread | /// Pass fatal exception message to UI thread | ||||
void handleRunawayException(const std::exception *e); | void handleRunawayException(const std::exception *e); | ||||
}; | }; | ||||
/** Main Bitcoin application object */ | /** Main Bitcoin application object */ | ||||
class BitcoinApplication : public QApplication { | class BitcoinApplication : public QApplication { | ||||
Q_OBJECT | Q_OBJECT | ||||
public: | public: | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | bool BitcoinABC::baseInitialize(Config &config, RPCServer &rpcServer) { | ||||
return true; | return true; | ||||
} | } | ||||
void BitcoinABC::initialize(Config *cfg, | void BitcoinABC::initialize(Config *cfg, | ||||
HTTPRPCRequestProcessor *httpRPCRequestProcessor) { | HTTPRPCRequestProcessor *httpRPCRequestProcessor) { | ||||
Config &config(*cfg); | Config &config(*cfg); | ||||
try { | try { | ||||
qDebug() << __func__ << ": Running initialization in thread"; | qDebug() << __func__ << ": Running initialization in thread"; | ||||
bool rv = AppInitMain(config, *httpRPCRequestProcessor, threadGroup, | bool rv = AppInitMain(config, *httpRPCRequestProcessor); | ||||
scheduler); | |||||
Q_EMIT initializeResult(rv); | Q_EMIT initializeResult(rv); | ||||
} catch (const std::exception &e) { | } catch (const std::exception &e) { | ||||
handleRunawayException(&e); | handleRunawayException(&e); | ||||
} catch (...) { | } catch (...) { | ||||
handleRunawayException(nullptr); | handleRunawayException(nullptr); | ||||
} | } | ||||
} | } | ||||
void BitcoinABC::shutdown() { | void BitcoinABC::shutdown() { | ||||
try { | try { | ||||
qDebug() << __func__ << ": Running Shutdown in thread"; | qDebug() << __func__ << ": Running Shutdown in thread"; | ||||
Interrupt(threadGroup); | Interrupt(); | ||||
threadGroup.join_all(); | |||||
Shutdown(); | Shutdown(); | ||||
qDebug() << __func__ << ": Shutdown finished"; | qDebug() << __func__ << ": Shutdown finished"; | ||||
Q_EMIT shutdownResult(); | Q_EMIT shutdownResult(); | ||||
} catch (const std::exception &e) { | } catch (const std::exception &e) { | ||||
handleRunawayException(&e); | handleRunawayException(&e); | ||||
} catch (...) { | } catch (...) { | ||||
handleRunawayException(nullptr); | handleRunawayException(nullptr); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 511 Lines • Show Last 20 Lines |