* report timeouts (from Connect) and fail if they happen in pkgAcqMetaSig
authorMichael Vogt <michael.vogt@ubuntu.com>
Tue, 7 Jun 2005 13:41:11 +0000 (13:41 +0000)
committerMichael Vogt <michael.vogt@ubuntu.com>
Tue, 7 Jun 2005 13:41:11 +0000 (13:41 +0000)
apt-pkg/acquire-item.cc
methods/connect.cc

index b2f8966..14acad8 100644 (file)
@@ -400,6 +400,12 @@ void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
    string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI);
    unlink(Final.c_str());
 
+   // if we get a timeout if fail
+   if(LookupTag(Message,"FailReason") == "Timeout") {
+      Item::Failed(Message,Cnf);
+      return;
+   }
+
    // queue a pkgAcqMetaIndex with no sigfile
    new pkgAcqMetaIndex(Owner, MetaIndexURI, MetaIndexURIDesc, MetaIndexShortDesc,
                       "", IndexTargets, MetaIndexParser);
index 981ac13..b85df68 100644 (file)
@@ -88,9 +88,11 @@ static bool DoConnect(struct addrinfo *Addr,string Host,
    
    /* This implements a timeout for connect by opening the connection
       nonblocking */
-   if (WaitFd(Fd,true,TimeOut) == false)
+   if (WaitFd(Fd,true,TimeOut) == false) {
+      Owner->SetFailExtraMsg("\nFailReason: Timeout");
       return _error->Error(_("Could not connect to %s:%s (%s), "
                           "connection timed out"),Host.c_str(),Service,Name);
+   }
 
    // Check the socket for an error condition
    unsigned int Err;