diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-05-20 14:54:33 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-05-20 15:15:45 +0200 |
commit | 3919059deb60d6ead9defc9d213a3f0c2ab72e90 (patch) | |
tree | 5493bd50b9a5c758d61400e4b06f8303873a302e /src/banman.cpp | |
parent | 4d0c00dffd13df9b055dbca244783c5de9ca23a5 (diff) |
refactor: Move code from ctor into private `BanMan::LoadBanlist()`
Co-authored-by: Anthony Towns <aj@erisian.com.au>
Diffstat (limited to 'src/banman.cpp')
-rw-r--r-- | src/banman.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/banman.cpp b/src/banman.cpp index b28e3f7f7c..901d91809e 100644 --- a/src/banman.cpp +++ b/src/banman.cpp @@ -16,6 +16,19 @@ BanMan::BanMan(fs::path ban_file, CClientUIInterface* client_interface, int64_t default_ban_time) : m_client_interface(client_interface), m_ban_db(std::move(ban_file)), m_default_ban_time(default_ban_time) { + LoadBanlist(); + DumpBanlist(); +} + +BanMan::~BanMan() +{ + DumpBanlist(); +} + +void BanMan::LoadBanlist() +{ + LOCK(m_cs_banned); + if (m_client_interface) m_client_interface->InitMessage(_("Loading banlist…").translated); int64_t n_start = GetTimeMillis(); @@ -29,13 +42,6 @@ BanMan::BanMan(fs::path ban_file, CClientUIInterface* client_interface, int64_t m_banned = {}; m_is_dirty = true; } - - DumpBanlist(); -} - -BanMan::~BanMan() -{ - DumpBanlist(); } void BanMan::DumpBanlist() |