move WSAStartup to init

WSAStartup should be called before using any other socket
functions. BindListenPort is not called if not listening.

Closes #2585.
This commit is contained in:
Wladimir J. van der Laan
2013-04-28 08:51:49 +02:00
parent 85157ae018
commit d23fa49c52
2 changed files with 8 additions and 12 deletions

View File

@ -453,6 +453,14 @@ bool AppInit2(boost::thread_group& threadGroup)
typedef BOOL (WINAPI *PSETPROCDEPPOL)(DWORD);
PSETPROCDEPPOL setProcDEPPol = (PSETPROCDEPPOL)GetProcAddress(GetModuleHandleA("Kernel32.dll"), "SetProcessDEPPolicy");
if (setProcDEPPol != NULL) setProcDEPPol(PROCESS_DEP_ENABLE);
// Initialize Windows Sockets
WSADATA wsadata;
int ret = WSAStartup(MAKEWORD(2,2), &wsadata);
if (ret != NO_ERROR)
{
return InitError(strprintf("Error: TCP/IP socket library failed to start (WSAStartup returned error %d)", ret));
}
#endif
#ifndef WIN32
umask(077);