| 39 | } |
| 40 | |
| 41 | void BanMan::DumpBanlist() |
| 42 | { |
| 43 | static Mutex dump_mutex; |
| 44 | LOCK(dump_mutex); |
| 45 | |
| 46 | banmap_t banmap; |
| 47 | { |
| 48 | LOCK(m_cs_banned); |
| 49 | SweepBanned(); |
| 50 | if (!BannedSetIsDirty()) return; |
| 51 | banmap = m_banned; |
| 52 | SetBannedSetDirty(false); |
| 53 | } |
| 54 | |
| 55 | int64_t n_start = GetTimeMillis(); |
| 56 | if (!m_ban_db.Write(banmap)) { |
| 57 | SetBannedSetDirty(true); |
| 58 | } |
| 59 | |
| 60 | LogPrint(BCLog::NET, "Flushed %d banned node addresses/subnets to disk %dms\n", banmap.size(), |
| 61 | GetTimeMillis() - n_start); |
| 62 | } |
| 63 | |
| 64 | void BanMan::ClearBanned() |
| 65 | { |