diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-07-09 08:16:51 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-07-09 08:16:51 +0000 |
commit | 633b743b69c6fc7bbe2a8ec596df3fc2fc4d95e0 (patch) | |
tree | e8eae8c77c476d543f0a992666f8dfdf1b25a52b /urpm/mirrors.pm | |
parent | 76e1f087e806b7c2104f8785f56e9913403cba3f (diff) | |
download | urpmi-633b743b69c6fc7bbe2a8ec596df3fc2fc4d95e0.tar urpmi-633b743b69c6fc7bbe2a8ec596df3fc2fc4d95e0.tar.gz urpmi-633b743b69c6fc7bbe2a8ec596df3fc2fc4d95e0.tar.bz2 urpmi-633b743b69c6fc7bbe2a8ec596df3fc2fc4d95e0.tar.xz urpmi-633b743b69c6fc7bbe2a8ec596df3fc2fc4d95e0.zip |
set network_mtime in _pick_one_, it's cleaner (since we don't need to set
cache's network_mtime everytime we use the cache)
Diffstat (limited to 'urpm/mirrors.pm')
-rw-r--r-- | urpm/mirrors.pm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/urpm/mirrors.pm b/urpm/mirrors.pm index e01c1a68..29e30894 100644 --- a/urpm/mirrors.pm +++ b/urpm/mirrors.pm @@ -45,8 +45,7 @@ sub _pick_one { my @l = split(' ', $mirrorlists); foreach my $mirrorlist (@l) { - if (my $cache = _pick_one_($urpm, $mirrorlist, $allow_cache_update)) { - $mirrorlist ne $l[-1] and $cache->{network_mtime} = _network_mtime(); + if (my $cache = _pick_one_($urpm, $mirrorlist, $allow_cache_update, $mirrorlist ne $l[-1])) { return $cache->{chosen}; } } @@ -56,7 +55,7 @@ sub _pick_one { #- side-effects: $urpm->{mirrors_cache} sub _pick_one_ { - my ($urpm, $mirrorlist, $allow_cache_update) = @_; + my ($urpm, $mirrorlist, $allow_cache_update, $set_network_mtime) = @_; my $cache = _cache__may_clean_if_outdated($urpm, $mirrorlist, $allow_cache_update); @@ -68,6 +67,9 @@ sub _pick_one_ { $cache->{list} = [ _list($urpm, $mirrorlist) ]; } $cache->{time} = time(); + + # the cache will be deemed outdated if network_mtime is more recent than the cache's + $cache->{network_mtime} = _network_mtime() if $set_network_mtime; } $cache->{chosen} = $cache->{list}[0]{url} or return; |