|
@@ -1,6 +1,6 @@
|
|
|
// -*- mode: cpp; mode: fold -*-
|
|
// -*- mode: cpp; mode: fold -*-
|
|
|
// Description /*{{{*/
|
|
// Description /*{{{*/
|
|
|
-// $Id: ftp.cc,v 1.11 1999/05/27 05:51:18 jgg Exp $
|
|
|
|
|
|
|
+// $Id: ftp.cc,v 1.12 1999/05/28 07:04:45 jgg Exp $
|
|
|
/* ######################################################################
|
|
/* ######################################################################
|
|
|
|
|
|
|
|
HTTP Aquire Method - This is the FTP aquire method for APT.
|
|
HTTP Aquire Method - This is the FTP aquire method for APT.
|
|
@@ -173,19 +173,21 @@ bool FTPConn::Open(pkgAcqMethod *Owner)
|
|
|
SetNonBlock(ServerFd,true);
|
|
SetNonBlock(ServerFd,true);
|
|
|
if (connect(ServerFd,LastHostAddr->ai_addr,LastHostAddr->ai_addrlen) < 0 &&
|
|
if (connect(ServerFd,LastHostAddr->ai_addr,LastHostAddr->ai_addrlen) < 0 &&
|
|
|
errno != EINPROGRESS)
|
|
errno != EINPROGRESS)
|
|
|
- return _error->Errno("connect","Connect initiate the connection");
|
|
|
|
|
|
|
+ return _error->Errno("connect","Cannot initiate the connection "
|
|
|
|
|
+ "to %s (%s).",Host.c_str(),Name);
|
|
|
Peer = *((struct sockaddr_in *)LastHostAddr->ai_addr);
|
|
Peer = *((struct sockaddr_in *)LastHostAddr->ai_addr);
|
|
|
|
|
|
|
|
/* This implements a timeout for connect by opening the connection
|
|
/* This implements a timeout for connect by opening the connection
|
|
|
nonblocking */
|
|
nonblocking */
|
|
|
if (WaitFd(ServerFd,true,TimeOut) == false)
|
|
if (WaitFd(ServerFd,true,TimeOut) == false)
|
|
|
- return _error->Error("Could not connect, connection timed out");
|
|
|
|
|
|
|
+ return _error->Error("Could not connect to %s (%s), "
|
|
|
|
|
+ "connection timed out",Host.c_str(),Name);
|
|
|
unsigned int Err;
|
|
unsigned int Err;
|
|
|
unsigned int Len = sizeof(Err);
|
|
unsigned int Len = sizeof(Err);
|
|
|
if (getsockopt(ServerFd,SOL_SOCKET,SO_ERROR,&Err,&Len) != 0)
|
|
if (getsockopt(ServerFd,SOL_SOCKET,SO_ERROR,&Err,&Len) != 0)
|
|
|
return _error->Errno("getsockopt","Failed");
|
|
return _error->Errno("getsockopt","Failed");
|
|
|
if (Err != 0)
|
|
if (Err != 0)
|
|
|
- return _error->Error("Could not connect.");
|
|
|
|
|
|
|
+ return _error->Error("Could not connect to %s (%s).",Host.c_str(),Name);
|
|
|
|
|
|
|
|
Owner->Status("Logging in");
|
|
Owner->Status("Logging in");
|
|
|
return Login();
|
|
return Login();
|
|
@@ -846,6 +848,7 @@ bool FtpMethod::Fetch(FetchItem *Itm)
|
|
|
// Could not connect is a transient error..
|
|
// Could not connect is a transient error..
|
|
|
if (Server->Open(this) == false)
|
|
if (Server->Open(this) == false)
|
|
|
{
|
|
{
|
|
|
|
|
+ Server->Close();
|
|
|
Fail(true);
|
|
Fail(true);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|