X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/dc738e7ae6a9c14992279dc2c52f71b14ced53aa..75dd8af14b76bb84a69a927ecae93f60600b9667:/methods/connect.cc diff --git a/methods/connect.cc b/methods/connect.cc index 23961d83b..8c2ac6d56 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: connect.cc,v 1.10 2003/02/10 07:34:41 doogie Exp $ +// $Id: connect.cc,v 1.10.2.1 2004/01/16 18:58:50 mdz Exp $ /* ###################################################################### Connect - Replacement connect call @@ -11,7 +11,6 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include #include "connect.h" #include #include @@ -27,6 +26,7 @@ #include #include "rfc2553emu.h" +#include /*}}}*/ static string LastHost; @@ -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); }