From 40c7f3e170c68f7b1cfb6876e1e583da80e2f845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 1 Jan 2024 21:36:06 +0800 Subject: [PATCH] Fix geoip close --- common/geoip/reader.go | 4 ++++ route/router.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/geoip/reader.go b/common/geoip/reader.go index c6028bb2..9e225f75 100644 --- a/common/geoip/reader.go +++ b/common/geoip/reader.go @@ -32,3 +32,7 @@ func (r *Reader) Lookup(addr netip.Addr) string { } return "unknown" } + +func (r *Reader) Close() error { + return r.reader.Close() +} diff --git a/route/router.go b/route/router.go index b5f0bbbf..a389aaee 100644 --- a/route/router.go +++ b/route/router.go @@ -535,7 +535,7 @@ func (r *Router) Close() error { } if r.geoIPReader != nil { r.logger.Trace("closing geoip reader") - err = E.Append(err, common.Close(r.geoIPReader), func(err error) error { + err = E.Append(err, r.geoIPReader.Close(), func(err error) error { return E.Cause(err, "close geoip reader") }) }