close geoip db on shutdown
This commit is contained in:
parent
bdc62d3715
commit
5f0044d276
2 changed files with 15 additions and 0 deletions
|
@ -177,6 +177,9 @@ func ShutdownCrowdsecRoutines() error {
|
|||
// He's dead, Jim.
|
||||
crowdsecTomb.Kill(nil)
|
||||
|
||||
// close the potential geoips reader we have to avoid leaking ressources on reload
|
||||
exprhelpers.GeoIPClose()
|
||||
|
||||
return reterr
|
||||
}
|
||||
|
||||
|
|
|
@ -102,6 +102,18 @@ func GeoIPInit(datadir string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func GeoIPClose() {
|
||||
if geoIPCityReader != nil {
|
||||
geoIPCityReader.Close()
|
||||
}
|
||||
if geoIPASNReader != nil {
|
||||
geoIPASNReader.Close()
|
||||
}
|
||||
if geoIPRangeReader != nil {
|
||||
geoIPRangeReader.Close()
|
||||
}
|
||||
}
|
||||
|
||||
func Init(databaseClient *database.Client) error {
|
||||
dataFile = make(map[string][]string)
|
||||
dataFileRegex = make(map[string][]*regexp.Regexp)
|
||||
|
|
Loading…
Reference in a new issue