Skip to content

FTPClientSession::close() error? #1880

@micheleselea

Description

@micheleselea

I probably found a problem in close function of FTPClientSession, here is the function:

void FTPClientSession::close()
{
	logout();
	_pControlSocket->close();
	delete _pControlSocket;
	_pControlSocket = 0;
	_serverReady = false;
}

it's called in destructor of FTPClientSession as:

	try
	{
		close();
	}
	catch (...) 
	{
	}

So it's safe: the problem here is in the logout function inside , because it does something like

		try { endTransfer(); }
		catch (...) { }
		std::string response;
		sendCommand("QUIT", response);
		_isLoggedIn = false;

If, as in my environment, the sendCommand throw exception because socket is broken or whatever, you end up in FTPClientSession::close() exit too early without do the close of the FTP control socket.
Probably in close() function logout should be under try catch

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions