]> git.saurik.com Git - apt.git/blobdiff - methods/connect.cc
* merged from mainline
[apt.git] / methods / connect.cc
index 981ac1371cc1d902eabf011fb398f5126db94466..8c2ac6d56dab4451b41ba0208297cad60c40fbe1 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;
@@ -101,6 +103,8 @@ static bool DoConnect(struct addrinfo *Addr,string Host,
    if (Err != 0)
    {
       errno = Err;
+      if(errno == ECONNREFUSED)
+         Owner->SetFailExtraMsg("\nFailReason: ConnectionRefused");
       return _error->Errno("connect",_("Could not connect to %s:%s (%s)."),Host.c_str(),
                           Service,Name);
    }
@@ -164,8 +168,11 @@ bool Connect(string Host,int Port,const char *Service,int DefPort,int &Fd,
            }
            
            if (Res == EAI_AGAIN)
+           {
+              Owner->SetFailExtraMsg("\nFailReason: TmpResolveFailure");
               return _error->Error(_("Temporary failure resolving '%s'"),
                                    Host.c_str());
+           }
            return _error->Error(_("Something wicked happened resolving '%s:%s' (%i)"),
                                 Host.c_str(),ServStr,Res);
         }