From 40774e1ccd2bad20a3f184941825f9416d7742a6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 15 Aug 2017 13:48:11 +0200 Subject: [PATCH] Use blocking sockets from non-main threads for passive FTP too This extends the changes of d421373c2eee777fd1300fcfb56971f9248ba382 to the case of passive FTP, which created wxSocketClient directly and so didn't use the correct flags when used from a worker thread. See #17937. --- src/common/ftp.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/ftp.cpp b/src/common/ftp.cpp index 4644099901..84ad5f28f9 100644 --- a/src/common/ftp.cpp +++ b/src/common/ftp.cpp @@ -647,7 +647,11 @@ wxSocketBase *wxFTP::GetPassivePort() addr.Hostname(hostaddr); addr.Service(port); - wxSocketClient *client = new wxSocketClient(); + // If we're used from a worker thread or can't dispatch events even though + // we're in the main one, we can't use non-blocking sockets. + wxSocketClient* const + client = new wxSocketClient(wxSocketClient::GetBlockingFlagIfNeeded()); + if ( !client->Connect(addr) ) { m_lastError = wxPROTO_CONNERR;