MCPcopy Create free account
hub / github.com/ElementsProject/elements / Close

Method Close

src/wallet/bdb.cpp:79–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77//
78
79void BerkeleyEnvironment::Close()
80{
81 if (!fDbEnvInit)
82 return;
83
84 fDbEnvInit = false;
85
86 for (auto& db : m_databases) {
87 BerkeleyDatabase& database = db.second.get();
88 assert(database.m_refcount <= 0);
89 if (database.m_db) {
90 database.m_db->close(0);
91 database.m_db.reset();
92 }
93 }
94
95 FILE* error_file = nullptr;
96 dbenv->get_errfile(&error_file);
97
98 int ret = dbenv->close(0);
99 if (ret != 0)
100 LogPrintf("BerkeleyEnvironment::Close: Error %d closing database environment: %s\n", ret, DbEnv::strerror(ret));
101 if (!fMockDb)
102 DbEnv((u_int32_t)0).remove(strPath.c_str(), 0);
103
104 if (error_file) fclose(error_file);
105
106 UnlockDirectory(fs::PathFromString(strPath), ".walletlock");
107}
108
109void BerkeleyEnvironment::Reset()
110{

Callers 8

fork_daemonFunction · 0.45
AppInitFunction · 0.45
RewriteMethod · 0.45
WalletToolReleaseWalletFunction · 0.45
ExecuteWalletToolFuncFunction · 0.45
StopWalletsFunction · 0.45
DumpWalletFunction · 0.45
WalletToolReleaseWalletFunction · 0.45

Calls 7

UnlockDirectoryFunction · 0.85
PathFromStringFunction · 0.85
getMethod · 0.45
closeMethod · 0.45
resetMethod · 0.45
removeMethod · 0.45
FlushMethod · 0.45

Tested by

no test coverage detected