void CDBEnv::EnvShutdown() { if (!fDbEnvInit) return; fDbEnvInit = false; int ret = dbenv->close(0); if (ret != 0) LogPrintf("CDBEnv::EnvShutdown: Error %d shutting down database environment: %s\n", ret, DbEnv::strerror(ret)); if (!fMockDb) DbEnv(0).remove(strPath.c_str(), 0); }
void BerkeleyEnvironment::Close() { if (!fDbEnvInit) return; fDbEnvInit = false; for (auto& db : mapDb) { auto count = mapFileUseCount.find(db.first); assert(count == mapFileUseCount.end() || count->second == 0); if (db.second) { db.second->close(0); delete db.second; db.second = nullptr; } } int ret = dbenv->close(0); if (ret != 0) LogPrintf("BerkeleyEnvironment::Close: Error %d closing database environment: %s\n", ret, DbEnv::strerror(ret)); if (!fMockDb) DbEnv((u_int32_t)0).remove(strPath.c_str(), 0); }