Fix data race condition in BanMan::DumpBanlist()

The m_is_dirty value being read in BannedSetIsDirty() can differ from
the value being set in SweepBanned(), i.e., be inconsistent with a
BanMan instance internal state.
This commit is contained in:
Hennadii Stepanov 2022-01-26 16:38:21 +02:00
parent 5e20e9ec38
commit 33bda6ab87
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -43,9 +43,11 @@ void BanMan::DumpBanlist()
static Mutex dump_mutex;
LOCK(dump_mutex);
SweepBanned(); // clean unused entries (if bantime has expired)
{
LOCK(m_cs_banned);
SweepBanned();
if (!BannedSetIsDirty()) return;
}
int64_t n_start = GetTimeMillis();