From 5cf85da1ed28e99ec69860a55a0a17d8ee3c633c Mon Sep 17 00:00:00 2001 From: Kevin Hock Date: Thu, 28 Apr 2005 02:29:01 +0000 Subject: [PATCH] Fix for unexplained change in socket behavior where failed connections throw a CONNECT event immediately before thowing a LOST event. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33905 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/corefoundation/gsockosx.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mac/corefoundation/gsockosx.cpp b/src/mac/corefoundation/gsockosx.cpp index 628cf47786..9e057ad1f4 100644 --- a/src/mac/corefoundation/gsockosx.cpp +++ b/src/mac/corefoundation/gsockosx.cpp @@ -39,7 +39,14 @@ void Mac_Socket_Callback(CFSocketRef s, CFSocketCallBackType callbackType, { case kCFSocketConnectCallBack: assert(!socket->m_server); - socket->Detected_Write(); + // KH: If data is non-NULL, the connect failed, do not call Detected_Write, + // which will only end up creating a spurious connect event because the + // call to getsocketopt SO_ERROR inexplicably returns no error. + // The change in behavior cannot be traced to any particular commit or + // timeframe so I'm not sure what to think, but after so many hours, + // this seems to address the issue and it's time to move on. + if (data == NULL) + socket->Detected_Write(); break; case kCFSocketReadCallBack: socket->Detected_Read(); -- 2.45.2