Fix geolocation lookup errors during device location estimation
This commit is contained in:
@@ -205,6 +205,7 @@ func SetInternetLocation(ip net.IP, source DeviceLocationSource) (dl *DeviceLoca
|
|||||||
geoLoc, err := geoip.GetLocation(ip)
|
geoLoc, err := geoip.GetLocation(ip)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warningf("netenv: failed to get geolocation data of %s (from %s): %s", ip, source, err)
|
log.Warningf("netenv: failed to get geolocation data of %s (from %s): %s", ip, source, err)
|
||||||
|
return nil, false
|
||||||
} else {
|
} else {
|
||||||
loc.Location = geoLoc
|
loc.Location = geoLoc
|
||||||
}
|
}
|
||||||
@@ -214,6 +215,10 @@ func SetInternetLocation(ip net.IP, source DeviceLocationSource) (dl *DeviceLoca
|
|||||||
}
|
}
|
||||||
|
|
||||||
func addLocation(dl *DeviceLocation) {
|
func addLocation(dl *DeviceLocation) {
|
||||||
|
if dl == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
locationsLock.Lock()
|
locationsLock.Lock()
|
||||||
defer locationsLock.Unlock()
|
defer locationsLock.Unlock()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user