[ wxwindows-Bugs-1517375 ] wxFTP cannot reconnect if an error occured when closing

SourceForge.net noreply at sourceforge.net
Wed Jul 5 00:35:56 PDT 2006


Bugs item #1517375, was opened at 2006-07-05 09:35
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1517375&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Hugues Lemonnier (hlemon)
Assigned to: Nobody/Anonymous (nobody)
Summary: wxFTP cannot reconnect if an error occured when closing

Initial Comment:
When I call wxFTP::Close(), an error occurs and I get
the meesage "Failed to close connection gracefully." in
the debug log. Then I cannot connect again using the
same instance of wxFTP.

The error in wxFTP::Close() seems to occur because
nothing can be read from the socket after sending the
'QUIT' command to the ftp server. A call to
wxFTP::GetResult() fails, setting m_bEncounteredError
member to true. Then the connection is closed, but the
bEncounteredError is not set back to false. When
calling Connect(), the wxFTP::GetResult() method is
called but exit with an error because it tests the
bEncounteredError value.

I solved this problem by subclassing wxFTP:

class WX_FTPClient : public wxFTP
{
public:
WX_FTPClient(void) : wxFTP() {;}
virtual ~WX_FTPClient(void) {;}

virtual	bool	Close(void) {
    bool ret = wxFTP::Close();
    m_bEncounteredError = false;
    return ret;
  }
};

The fix would be to add the line    
m_bEncounteredError = false;
in wxFTP::Close()


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1517375&group_id=9863




More information about the wx-dev mailing list