forked from lthn/blockchain
basic_db_accessor: fixed a bug in close()
This commit is contained in:
parent
cd1e3c115d
commit
320249f1f6
1 changed files with 8 additions and 2 deletions
|
|
@ -89,8 +89,11 @@ namespace tools
|
||||||
mutable performance_data m_gperformance_data;
|
mutable performance_data m_gperformance_data;
|
||||||
mutable std::unordered_map<container_handle, performance_data> m_performance_data_map;
|
mutable std::unordered_map<container_handle, performance_data> m_performance_data_map;
|
||||||
public:
|
public:
|
||||||
basic_db_accessor(std::shared_ptr<i_db_backend> backend, epee::shared_recursive_mutex& rwlock) :m_backend(backend), m_rwlock(rwlock), m_is_open(false)
|
basic_db_accessor(std::shared_ptr<i_db_backend> backend, epee::shared_recursive_mutex& rwlock)
|
||||||
{}
|
: m_backend(backend), m_rwlock(rwlock), m_is_open(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
~basic_db_accessor()
|
~basic_db_accessor()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
|
|
@ -239,8 +242,11 @@ namespace tools
|
||||||
bool close()
|
bool close()
|
||||||
{
|
{
|
||||||
m_is_open = false;
|
m_is_open = false;
|
||||||
|
if (!m_backend)
|
||||||
|
return true;
|
||||||
return m_backend->close();
|
return m_backend->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool open(const std::string& path, uint64_t cache_sz = CACHE_SIZE)
|
bool open(const std::string& path, uint64_t cache_sz = CACHE_SIZE)
|
||||||
{
|
{
|
||||||
bool r = m_backend->open(path, cache_sz);
|
bool r = m_backend->open(path, cache_sz);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue