From 2e56702ecedd83c4b7cb8de9de5c437c8c08e645 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Thu, 5 Oct 2017 13:35:20 -0400 Subject: banman: pass the banfile path in There's no need to hard-code the path here. Passing it in means that there are no ordering concerns wrt establishing the datadir. --- src/net.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/net.cpp') diff --git a/src/net.cpp b/src/net.cpp index 5479130320..fd74c58292 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -466,10 +466,9 @@ void BanMan::DumpBanlist() int64_t nStart = GetTimeMillis(); - CBanDB bandb; banmap_t banmap; GetBanned(banmap); - if (bandb.Write(banmap)) { + if (m_ban_db.Write(banmap)) { SetBannedSetDirty(false); } @@ -2431,16 +2430,14 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions) return true; } -BanMan::BanMan(CClientUIInterface* client_interface) : clientInterface(client_interface) +BanMan::BanMan(fs::path ban_file, CClientUIInterface* client_interface) : clientInterface(client_interface), m_ban_db(std::move(ban_file)) { if (clientInterface) clientInterface->InitMessage(_("Loading banlist...")); - // Load addresses from banlist.dat int64_t nStart = GetTimeMillis(); setBannedIsDirty = false; - CBanDB bandb; banmap_t banmap; - if (bandb.Read(banmap)) { + if (m_ban_db.Read(banmap)) { SetBanned(banmap); // thread save setter SetBannedSetDirty(false); // no need to write down, just read data SweepBanned(); // sweep out unused entries -- cgit v1.2.3