From 8d66bfd7ef4f128ffa94d226cd5e8774f89916dc Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 15 Aug 2017 19:30:42 +0200 Subject: [PATCH] Use blocking server socket in non-main threads for active FTP This is similar to the previous commit, but for active FTP connections. wxSocketServer was also created directly in this case, without using wxProtocol ctor, so wxSOCKET_BLOCK must be explicitly specified when creating it from worker thread, just as it was already done in d421373c2eee777fd1300fcfb56971f9248ba382 for the other connections and in the previous commit for passive FTP ones. See #17937. --- src/common/ftp.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/ftp.cpp b/src/common/ftp.cpp index 84ad5f28f9..d1cd21b60b 100644 --- a/src/common/ftp.cpp +++ b/src/common/ftp.cpp @@ -582,7 +582,13 @@ wxSocketBase *wxFTP::GetActivePort() addrNew.AnyAddress(); addrNew.Service(0); // pick an open port number. - wxSocketServer *sockSrv = new wxSocketServer(addrNew); + wxSocketServer* const + sockSrv = new wxSocketServer + ( + addrNew, + wxSocketServer::GetBlockingFlagIfNeeded() + ); + if (!sockSrv->IsOk()) { // We use IsOk() here to see if everything is ok