Encapsulate BDB environment inside new CDBEnv class

Cleans up and organizes several scattered functions and variables related to
the BDB env.  Class CDBInit() existed to provide a
guaranteed-via-C++-destructor cleanup of the db environment.

A formal CDBEnv class provides all of this inside a single wrapper.
This commit is contained in:
Jeff Garzik
2012-05-13 21:37:39 -04:00
committed by Jeff Garzik
parent b52a270538
commit cd9696fc97
4 changed files with 110 additions and 78 deletions

View File

@@ -54,9 +54,9 @@ void Shutdown(void* parg)
{
fShutdown = true;
nTransactionsUpdated++;
DBFlush(false);
bitdb.Flush(false);
StopNode();
DBFlush(true);
bitdb.Flush(true);
boost::filesystem::remove(GetPidFile());
UnregisterWallet(pwalletMain);
delete pwalletMain;
@@ -294,7 +294,7 @@ bool AppInit2()
}
fDebug = GetBoolArg("-debug");
fDetachDB = GetBoolArg("-detachdb", false);
bitdb.SetDetach(GetBoolArg("-detachdb", false));
#if !defined(WIN32) && !defined(QT_GUI)
fDaemon = GetBoolArg("-daemon");