// -*- 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
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
-#include <apti18n.h>
#include "connect.h"
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
#include <netdb.h>
#include "rfc2553emu.h"
+#include <apti18n.h>
/*}}}*/
static string LastHost;
/* 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;
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);
}
}
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);
}