fix a warning when GeoIP can't find the country for a site
This commit is contained in:
parent
6687a7a5c2
commit
e41c0a0867
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=113147
@ -125,19 +125,22 @@ if (%newdistance && $hostcount > 1) {
|
||||
foreach (keys %newdistance) {
|
||||
my $dist;
|
||||
my $cc = lc $gi->country_code_by_name($_);
|
||||
my ($lat_cc, $lon_cc) = getlatlon($cc)
|
||||
if defined $cc;
|
||||
|
||||
# Find the deltas
|
||||
my $delta_lat = $lat_cc - $lat_home;
|
||||
my $delta_lon = $lon_cc - $lon_home;
|
||||
if ($cc) {
|
||||
my ($lat_cc, $lon_cc) = getlatlon($cc)
|
||||
if defined $cc;
|
||||
|
||||
# Find the Great Circle distance
|
||||
my $temp = sin($delta_lat/2.0)**2 + cos($lat_home) * cos($lat_cc) * sin($delta_lon/2.0)**2;
|
||||
$dist = atan2(sqrt($temp),sqrt(1-$temp));
|
||||
# Find the deltas
|
||||
my $delta_lat = $lat_cc - $lat_home;
|
||||
my $delta_lon = $lon_cc - $lon_home;
|
||||
|
||||
$distance{$_} = [$dist, $expgood]
|
||||
if defined $dist;
|
||||
# Find the Great Circle distance
|
||||
my $temp = sin($delta_lat/2.0)**2 + cos($lat_home) * cos($lat_cc) * sin($delta_lon/2.0)**2;
|
||||
$dist = atan2(sqrt($temp),sqrt(1-$temp));
|
||||
|
||||
$distance{$_} = [$dist, $expgood]
|
||||
if defined $dist;
|
||||
}
|
||||
}
|
||||
|
||||
open RANKS, ">$rankfile";
|
||||
|
@ -125,19 +125,22 @@ if (%newdistance && $hostcount > 1) {
|
||||
foreach (keys %newdistance) {
|
||||
my $dist;
|
||||
my $cc = lc $gi->country_code_by_name($_);
|
||||
my ($lat_cc, $lon_cc) = getlatlon($cc)
|
||||
if defined $cc;
|
||||
|
||||
# Find the deltas
|
||||
my $delta_lat = $lat_cc - $lat_home;
|
||||
my $delta_lon = $lon_cc - $lon_home;
|
||||
if ($cc) {
|
||||
my ($lat_cc, $lon_cc) = getlatlon($cc)
|
||||
if defined $cc;
|
||||
|
||||
# Find the Great Circle distance
|
||||
my $temp = sin($delta_lat/2.0)**2 + cos($lat_home) * cos($lat_cc) * sin($delta_lon/2.0)**2;
|
||||
$dist = atan2(sqrt($temp),sqrt(1-$temp));
|
||||
# Find the deltas
|
||||
my $delta_lat = $lat_cc - $lat_home;
|
||||
my $delta_lon = $lon_cc - $lon_home;
|
||||
|
||||
$distance{$_} = [$dist, $expgood]
|
||||
if defined $dist;
|
||||
# Find the Great Circle distance
|
||||
my $temp = sin($delta_lat/2.0)**2 + cos($lat_home) * cos($lat_cc) * sin($delta_lon/2.0)**2;
|
||||
$dist = atan2(sqrt($temp),sqrt(1-$temp));
|
||||
|
||||
$distance{$_} = [$dist, $expgood]
|
||||
if defined $dist;
|
||||
}
|
||||
}
|
||||
|
||||
open RANKS, ">$rankfile";
|
||||
|
Loading…
Reference in New Issue
Block a user