| 84 | // |
| 85 | |
| 86 | void BerkeleyEnvironment::Close() |
| 87 | { |
| 88 | if (!fDbEnvInit) |
| 89 | return; |
| 90 | |
| 91 | fDbEnvInit = false; |
| 92 | |
| 93 | for (auto& db : mapDb) { |
| 94 | auto count = mapFileUseCount.find(db.first); |
| 95 | assert(count == mapFileUseCount.end() || count->second == 0); |
| 96 | if (db.second) { |
| 97 | db.second->close(0); |
| 98 | delete db.second; |
| 99 | db.second = nullptr; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | int ret = dbenv->close(0); |
| 104 | if (ret != 0) |
| 105 | LogPrintf("BerkeleyEnvironment::Close: Error %d closing database environment: %s\n", ret, DbEnv::strerror(ret)); |
| 106 | if (!fMockDb) |
| 107 | DbEnv((u_int32_t)0).remove(strPath.c_str(), 0); |
| 108 | } |
| 109 | |
| 110 | void BerkeleyEnvironment::Reset() |
| 111 | { |
no test coverage detected