From 47eb38f452c7477aab782dce56e85a0a85e22764 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 21 Feb 2006 12:23:22 +0000 Subject: * handle network failures more gracefully (default apt sources spec) apt-pkg/acquire-item.cc: - on network failures (Timeout,ResolveFailure,ConnectionRefused) move the old (known good) sigfile back and don't touch the indexfiles cmdline/apt-get.cc: - don't fail on apt-get update problems but issue a warning instead --- apt-pkg/acquire-item.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 1fa929aad..dee00c63e 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -321,8 +321,9 @@ pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner, DestFile = _config->FindDir("Dir::State::lists") + "partial/"; DestFile += URItoFileName(URI); - // remove any partial downloaded sig-file. it may confuse proxies - // and is too small to warrant a partial download anyway + // remove any partial downloaded sig-file in partial/. + // it may confuse proxies and is too small to warrant a + // partial download anyway unlink(DestFile.c_str()); // Create the item @@ -389,17 +390,20 @@ void pkgAcqMetaSig::Done(string Message,unsigned long Size,string MD5, /*}}}*/ void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf) { + string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI); // if we get a network error we fail gracefully if(LookupTag(Message,"FailReason") == "Timeout" || LookupTag(Message,"FailReason") == "TmpResolveFailure" || LookupTag(Message,"FailReason") == "ConnectionRefused") { Item::Failed(Message,Cnf); + // move the sigfile back on network failures (and re-authenticated?) + if(FileExists(DestFile)) + Rename(DestFile,Final); return; } // Delete any existing sigfile when the acquire failed - string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI); unlink(Final.c_str()); // queue a pkgAcqMetaIndex with no sigfile -- cgit v1.2.3