X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/79da30927621c8ab01ff9e9a834331b922e7fbd1..bb356c9ea78919fbc01e19c36bb925c80abb68a4:/src/mac/carbon/gsocket.c diff --git a/src/mac/carbon/gsocket.c b/src/mac/carbon/gsocket.c index 5411425556..ef89f1a511 100644 --- a/src/mac/carbon/gsocket.c +++ b/src/mac/carbon/gsocket.c @@ -84,7 +84,7 @@ extern pascal void OTDebugStr(const char* str); #include #endif InetSvcRef gInetSvcRef = 0 ; - +int gOTInited = 0 ; OSStatus DoNegotiateIPReuseAddrOption(EndpointRef ep, Boolean enableReuseIPMode); @@ -211,6 +211,7 @@ int GSocket_Verify_Inited() return TRUE ; InitOpenTransportInContext(kInitOTForApplicationMask, &clientcontext); + gOTInited = 1 ; gInetSvcRef = OTOpenInternetServicesInContext(kDefaultInternetServicesPath, NULL, &err, clientcontext); #else @@ -218,6 +219,7 @@ int GSocket_Verify_Inited() return TRUE ; InitOpenTransport() ; + gOTInited = 1 ; gInetSvcRef = OTOpenInternetServices(kDefaultInternetServicesPath, NULL, &err); #endif if ( gInetSvcRef == NULL || err != kOTNoError ) @@ -230,13 +232,16 @@ int GSocket_Verify_Inited() void GSocket_Cleanup() { - if ( gInetSvcRef != NULL ) - OTCloseProvider( gInetSvcRef ); -#if TARGET_CARBON - CloseOpenTransportInContext( NULL ) ; -#else - CloseOpenTransport() ; -#endif + if ( gOTInited != 0 ) + { + if ( gInetSvcRef != NULL ) + OTCloseProvider( gInetSvcRef ); + #if TARGET_CARBON + CloseOpenTransportInContext( NULL ) ; + #else + CloseOpenTransport() ; + #endif + } } /* Constructors / Destructors for GSocket */ @@ -267,7 +272,7 @@ GSocket *GSocket_new() socket->m_server = FALSE; socket->m_stream = TRUE; socket->m_non_blocking = FALSE; - socket->m_timeout = 10*1000; + socket->m_timeout = 1*1000; /* 10 sec * 1000 millisec */ socket->m_takesEvents = TRUE ; socket->m_mac_events = wxMacGetNotifierTable() ; @@ -1473,7 +1478,7 @@ GSocketError _GSocket_Input_Timeout(GSocket *socket) { OTResult state ; OTByteCount sz = 0 ; - state = OTGetEndpointState(socket->m_endpoint); + state = OTGetEndpointState(socket->m_endpoint); OTCountDataBytes( socket->m_endpoint , &sz ) ; if ( state == T_INCON || sz > 0 )