mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-11 23:58:18 +00:00
Merge pull request #2586 from laanwj/2013_04_winsock_init
move WSAStartup to init
This commit is contained in:
commit
33029bcedd
@ -453,6 +453,14 @@ bool AppInit2(boost::thread_group& threadGroup)
|
|||||||
typedef BOOL (WINAPI *PSETPROCDEPPOL)(DWORD);
|
typedef BOOL (WINAPI *PSETPROCDEPPOL)(DWORD);
|
||||||
PSETPROCDEPPOL setProcDEPPol = (PSETPROCDEPPOL)GetProcAddress(GetModuleHandleA("Kernel32.dll"), "SetProcessDEPPolicy");
|
PSETPROCDEPPOL setProcDEPPol = (PSETPROCDEPPOL)GetProcAddress(GetModuleHandleA("Kernel32.dll"), "SetProcessDEPPolicy");
|
||||||
if (setProcDEPPol != NULL) setProcDEPPol(PROCESS_DEP_ENABLE);
|
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
|
#endif
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
umask(077);
|
umask(077);
|
||||||
|
12
src/net.cpp
12
src/net.cpp
@ -1653,18 +1653,6 @@ bool BindListenPort(const CService &addrBind, string& strError)
|
|||||||
strError = "";
|
strError = "";
|
||||||
int nOne = 1;
|
int nOne = 1;
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
// Initialize Windows Sockets
|
|
||||||
WSADATA wsadata;
|
|
||||||
int ret = WSAStartup(MAKEWORD(2,2), &wsadata);
|
|
||||||
if (ret != NO_ERROR)
|
|
||||||
{
|
|
||||||
strError = strprintf("Error: TCP/IP socket library failed to start (WSAStartup returned error %d)", ret);
|
|
||||||
printf("%s\n", strError.c_str());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Create socket for listening for incoming connections
|
// Create socket for listening for incoming connections
|
||||||
#ifdef USE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct sockaddr_storage sockaddr;
|
struct sockaddr_storage sockaddr;
|
||||||
|
Loading…
Reference in New Issue
Block a user