mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 22:45:52 +00:00
Stop a crash that can happen during shutdown.
This commit is contained in:
@@ -54,6 +54,7 @@ Application::Application() :
|
|||||||
|
|
||||||
extern const char *RpcDBInit[], *TxnDBInit[], *LedgerDBInit[], *WalletDBInit[], *HashNodeDBInit[], *NetNodeDBInit[];
|
extern const char *RpcDBInit[], *TxnDBInit[], *LedgerDBInit[], *WalletDBInit[], *HashNodeDBInit[], *NetNodeDBInit[];
|
||||||
extern int RpcDBCount, TxnDBCount, LedgerDBCount, WalletDBCount, HashNodeDBCount, NetNodeDBCount;
|
extern int RpcDBCount, TxnDBCount, LedgerDBCount, WalletDBCount, HashNodeDBCount, NetNodeDBCount;
|
||||||
|
bool Instance::running = true;
|
||||||
|
|
||||||
void Application::stop()
|
void Application::stop()
|
||||||
{
|
{
|
||||||
@@ -65,6 +66,7 @@ void Application::stop()
|
|||||||
mAuxService.stop();
|
mAuxService.stop();
|
||||||
|
|
||||||
cLog(lsINFO) << "Stopped: " << mIOService.stopped();
|
cLog(lsINFO) << "Stopped: " << mIOService.stopped();
|
||||||
|
Instance::shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitDB(DatabaseCon** dbCon, const char *fileName, const char *dbInit[], int dbCount)
|
static void InitDB(DatabaseCon** dbCon, const char *fileName, const char *dbInit[], int dbCount)
|
||||||
|
|||||||
@@ -86,11 +86,13 @@ public:
|
|||||||
class Instance
|
class Instance
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
static bool running;
|
||||||
InstanceType& mType;
|
InstanceType& mType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Instance(InstanceType& t) : mType(t) { mType.addInstance(); }
|
Instance(InstanceType& t) : mType(t) { mType.addInstance(); }
|
||||||
~Instance() { mType.decInstance(); }
|
~Instance() { if (running) mType.decInstance(); }
|
||||||
|
static void shutdown() { running = false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user