X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7ff26ec2aef57714dcab523f8e8d4f2535d6fcfe..12ed316d02733e7111a6967f6ae41e2c0ceaa57a:/src/common/ftp.cpp diff --git a/src/common/ftp.cpp b/src/common/ftp.cpp index e9db032f8e..1d5e801965 100644 --- a/src/common/ftp.cpp +++ b/src/common/ftp.cpp @@ -20,7 +20,9 @@ #pragma hdrstop #endif -#if wxUSE_SOCKETS +#include "wx/setup.h" + +#if wxUSE_SOCKETS && wxUSE_STREAMS #ifndef __MWERKS__ #include @@ -398,11 +400,23 @@ public: : wxSocketOutputStream(*sock), m_ftp(ftp_clt) {} virtual ~wxOutputFTPStream(void) { - if (LastError() != wxStream_NOERROR) - m_ftp->GetResult('2'); - else - m_ftp->Abort(); - delete m_o_socket; + if ( IsOk() ) + { + // close data connection first, this will generate "transfer + // completed" reply + delete m_o_socket; + + // read this reply + m_ftp->GetResult('2'); + } + else + { + // abort data connection first + m_ftp->Abort(); + + // and close it after + delete m_o_socket; + } } };