Move DNS initialization out to when Netlib is initialized. This ensures that the initialization takes place on the Netlib Thread.

This commit is contained in:
rpotts%netscape.com 1998-09-22 07:02:20 +00:00
parent fe5cb0a943
commit f18f85177c

View File

@ -179,8 +179,7 @@ EventProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
static PRBool
OneTimeInit()
void net_InitAsyncDNS()
{
static char *windowClass = "NETLIB:DNSWindow";
@ -215,8 +214,6 @@ OneTimeInit()
DNS_TRACE(DNS_TRACE_LOOKUPS,
("DNS lookup: hidden window=%p msg=%d",
gDNSWindow, gMSGFoundDNS));
return NULL != gDNSWindow;
}
extern "C" int
@ -231,12 +228,10 @@ NET_AsyncDNSLookup(void* aContext,
PRHostEnt** aHoststructPtrPtr,
PRFileDesc* aSocket)
{
static PRBool firstTime = PR_TRUE;
if (firstTime) {
firstTime = PR_FALSE;
if (!OneTimeInit()) {
return -1;
}
/* DNS initialization failed... */
if (NULL == gDNSWindow) {
PR_ASSERT(0);
return -1;
}
*aHoststructPtrPtr = NULL;