From 4ef23f4fdfcddd9c110af5cf4ec76cbf64164fdf Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sat, 16 Feb 2002 20:58:21 +0000 Subject: (mirrors): add a timeout via "alarm" (needs testing) --- perl-install/crypto.pm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'perl-install/crypto.pm') diff --git a/perl-install/crypto.pm b/perl-install/crypto.pm index 60bd216d5..6ca002d0f 100644 --- a/perl-install/crypto.pm +++ b/perl-install/crypto.pm @@ -57,6 +57,9 @@ sub mirrors { #- http://www.linux-mandrake.com/mirrorsfull.list require http; my $f = http::getFile("http://www.linux-mandrake.com/mirrorsfull.list"); + + local $SIG{ALRM} = sub { die "timeout" }; + alarm 60; foreach (<$f>) { my ($arch, $url, $dir) = m|updates([^:]*):ftp://([^/]*)(/\S*)| or next; MDK::Common::System::compat_arch($arch) or @@ -69,6 +72,7 @@ sub mirrors { $mirrors{$url} = [ $land, $dir ]; } http::getFile('/XXX'); #- close connection. + alarm 0; #- now add static mirror (in case of something wrong happened above). add2hash(\%mirrors, \%static_mirrors); -- cgit v1.2.1