nostrdb: don't begin query if we have a bad lmdb env
In some weird multithreaded situations after we close the database, this can be an issue.
This commit is contained in:
@@ -864,7 +864,9 @@ static int _ndb_begin_query(struct ndb *ndb, struct ndb_txn *txn, int flags)
|
|||||||
{
|
{
|
||||||
txn->lmdb = &ndb->lmdb;
|
txn->lmdb = &ndb->lmdb;
|
||||||
MDB_txn **mdb_txn = (MDB_txn **)&txn->mdb_txn;
|
MDB_txn **mdb_txn = (MDB_txn **)&txn->mdb_txn;
|
||||||
return mdb_txn_begin(txn->lmdb->env, NULL, flags, mdb_txn) == 0;
|
if (!txn->lmdb->env)
|
||||||
|
return 0;
|
||||||
|
return mdb_txn_begin(txn->lmdb->env, NULL, flags, mdb_txn) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ndb_begin_query(struct ndb *ndb, struct ndb_txn *txn)
|
int ndb_begin_query(struct ndb *ndb, struct ndb_txn *txn)
|
||||||
|
|||||||
Reference in New Issue
Block a user