Skip to content

Commit

Permalink
lmdb: don't begin query if we have a bad lmdb env
Browse files Browse the repository at this point in the history
In some weird multithreaded situations after we close the database,
this can be an issue.

Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed Dec 12, 2023
1 parent 39f36f9 commit b00f9f0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nostrdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,8 @@ static int _ndb_begin_query(struct ndb *ndb, struct ndb_txn *txn, int flags)
{
txn->lmdb = &ndb->lmdb;
MDB_txn **mdb_txn = (MDB_txn **)&txn->mdb_txn;
if (!txn->lmdb->env)
return 0;
return mdb_txn_begin(txn->lmdb->env, NULL, flags, mdb_txn) == 0;
}

Expand Down

0 comments on commit b00f9f0

Please sign in to comment.