diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-02-21 12:23:22 +0000 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-02-21 12:23:22 +0000 |
commit | 47eb38f452c7477aab782dce56e85a0a85e22764 (patch) | |
tree | f210704682e5e817efa5d9707a84af8dd793a7ff /apt-pkg/acquire-item.cc | |
parent | a4977aac2bc7999f805550e3bcd5fe49958fe128 (diff) |
* 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
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r-- | apt-pkg/acquire-item.cc | 10 |
1 files changed, 7 insertions, 3 deletions
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 |