From a938356fed2ea92abed3ad61138f770133bccc90 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 12 May 2022 12:54:09 +0200 Subject: [PATCH] Fix region handling of broken mirrors The handling of region vs broken mirrors (in state "f") is wrong, and we might end up with the wrong URLs in foreign regions, like: | # ./generate_mirror_map| sort -u | at mirror.alwyzon.net/grml/|at.mirror.anexia.com/grml/ | br grml.c3sl.ufpr.br// | ch mirror.de.leaseweb.net/grml/|ftp.halifax.rwth-aachen.de/grml/|mirror.23m.com/grml/ | cn mirror.de.leaseweb.net/grml/|ftp.halifax.rwth-aachen.de/grml/|mirror.23m.com/grml/ | de mirror.de.leaseweb.net/grml/|ftp.halifax.rwth-aachen.de/grml/|mirror.23m.com/grml/ | fi mirror.de.leaseweb.net/grml/|ftp.halifax.rwth-aachen.de/grml/|mirror.23m.com/grml/ | gb mirror.bytemark.co.uk/grml/ | hk mirror-hk.koddos.net/grml/ | ir mirror.bardia.tech/grml/ | nl mirror.koddos.net/grml/|mirror.nl.leaseweb.net/grml/ | tw tw1.mirror.blendbyte.net/grml/ | ua grml.ip-connect.info//|grml.ip-connect.vn.ua// | us mirror.us.leaseweb.net/grml/|mirrors.rit.edu/grml/ Now with the fixed behavior, we get what we're expecting: | # ./generate_mirror_map| sort -u | at mirror.alwyzon.net/grml/|at.mirror.anexia.com/grml/ | br grml.c3sl.ufpr.br// | de mirror.23m.com/grml/|mirror.de.leaseweb.net/grml/|ftp.halifax.rwth-aachen.de/grml/ | gb mirror.bytemark.co.uk/grml/ | hk mirror-hk.koddos.net/grml/ | ir mirror.bardia.tech/grml/ | nl mirror.nl.leaseweb.net/grml/|mirror.koddos.net/grml/ | tw tw1.mirror.blendbyte.net/grml/ | ua grml.ip-connect.info//|grml.ip-connect.vn.ua// | us mirror.us.leaseweb.net/grml/|mirrors.rit.edu/grml/ --- bin/generate_mirror_map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/generate_mirror_map b/bin/generate_mirror_map index 6d37e1b..d41107c 100755 --- a/bin/generate_mirror_map +++ b/bin/generate_mirror_map @@ -17,9 +17,9 @@ foreach my $url ( keys %{$state} ) { $mirror = $state -> { $url } ; # a Mirmon::Mirror object my ($time, $history) = split('-', $mirror->{state_history}); my $last_state = substr($history,-1,1); + next if $last_state eq 'f'; my $region = $mirror->region; $regions_hash->{$region} = 1; - next if $last_state eq 'f'; $mirrors->{ $region } ||= []; $url =~ s/^http:\/\///; push @{$mirrors->{ $region }}, $url; -- 2.1.4