Stop a crash that can happen during shutdown.

This commit is contained in:
JoelKatz
2013-01-14 02:12:03 -08:00
parent 5fa43cc770
commit 61c07696a7
2 changed files with 5 additions and 1 deletions

View File

@@ -54,6 +54,7 @@ Application::Application() :
extern const char *RpcDBInit[], *TxnDBInit[], *LedgerDBInit[], *WalletDBInit[], *HashNodeDBInit[], *NetNodeDBInit[];
extern int RpcDBCount, TxnDBCount, LedgerDBCount, WalletDBCount, HashNodeDBCount, NetNodeDBCount;
bool Instance::running = true;
void Application::stop()
{
@@ -65,6 +66,7 @@ void Application::stop()
mAuxService.stop();
cLog(lsINFO) << "Stopped: " << mIOService.stopped();
Instance::shutdown();
}
static void InitDB(DatabaseCon** dbCon, const char *fileName, const char *dbInit[], int dbCount)

View File

@@ -86,11 +86,13 @@ public:
class Instance
{
protected:
static bool running;
InstanceType& mType;
public:
Instance(InstanceType& t) : mType(t) { mType.addInstance(); }
~Instance() { mType.decInstance(); }
~Instance() { if (running) mType.decInstance(); }
static void shutdown() { running = false; }
};
#endif