Skip to content

Commit f0b3fa7

Browse files
leoparenteclaude
andcommitted
chore: upgrade catch2, cpp-httplib, libmaxminddb; fix GeoIP test ordering
- Bump catch2 3.8.0→3.14.0 - Bump cpp-httplib 0.18.3→0.39.0 - Bump libmaxminddb 1.10.0→1.12.2 - yaml-cpp kept at 0.8.0 (0.9.0 causes heap corruption at process exit) - Add MaxmindDB::disable() to allow resetting singleton state in tests - Reset GeoIP/GeoASN singletons before "Geo enablement" section so tests pass regardless of Catch2 randomized execution order (new default in 3.x) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 94eceb1 commit f0b3fa7

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

conanfile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ class Pktvisor(ConanFile):
77
generators = "CMakeToolchain", "CMakeDeps"
88

99
def requirements(self):
10-
self.requires("catch2/3.8.0")
10+
self.requires("catch2/3.14.0")
1111
self.requires("corrade/2020.06")
12-
self.requires("cpp-httplib/0.18.3")
12+
self.requires("cpp-httplib/0.39.0")
1313
self.requires("docopt.cpp/0.6.3")
1414
self.requires("fast-cpp-csv-parser/cci.20240102")
1515
self.requires("json-schema-validator/2.3.0")
16-
self.requires("libmaxminddb/1.10.0")
16+
self.requires("libmaxminddb/1.12.2")
1717
self.requires("nlohmann_json/3.11.3")
1818
self.requires("openssl/3.3.2")
1919
if self.settings.os != "Windows":

src/GeoDB.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ class MaxmindDB
5757
~MaxmindDB();
5858

5959
void enable(const std::string &database_filename, int cache_size = DEFAULT_CACHE_SIZE);
60+
void disable()
61+
{
62+
if (_enabled) {
63+
MMDB_close(&_mmdb);
64+
_enabled = false;
65+
}
66+
_lru_geo_cache.reset();
67+
_lru_asn_cache.reset();
68+
}
6069
bool enabled() const
6170
{
6271
return _enabled;

src/tests/test_geoip.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ TEST_CASE("GeoIP", "[geoip]")
1313
{
1414
SECTION("Geo enablement")
1515
{
16+
visor::geo::GeoIP().disable();
17+
visor::geo::GeoASN().disable();
1618
CHECK(!visor::geo::GeoIP().enabled());
1719
CHECK_THROWS(visor::geo::GeoIP().enable("nonexistent.mmdb"));
1820
CHECK(!visor::geo::GeoIP().enabled());

0 commit comments

Comments
 (0)