aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-04-28 08:00:53 -0700
committerWladimir J. van der Laan <laanwj@gmail.com>2013-04-28 08:00:53 -0700
commit33029bcedd982f80f7e380bff586f3ab644decce (patch)
treefd2fe1116c25426ae657e99c2740200584b40256
parent85157ae0183ca0efd36608b225b5c59ba8885cb9 (diff)
parentd23fa49c52e9e0310f938379c5af91f0b4e5fe46 (diff)
downloadbitcoin-33029bcedd982f80f7e380bff586f3ab644decce.tar.xz
Merge pull request #2586 from laanwj/2013_04_winsock_init
move WSAStartup to init
-rw-r--r--src/init.cpp8
-rw-r--r--src/net.cpp12
2 files changed, 8 insertions, 12 deletions
diff --git a/src/init.cpp b/src/init.cpp
index f6485c3b1d..7024f3f785 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -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);
diff --git a/src/net.cpp b/src/net.cpp
index 755312682b..031126180d 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1653,18 +1653,6 @@ bool BindListenPort(const CService &addrBind, string& strError)
strError = "";
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
#ifdef USE_IPV6
struct sockaddr_storage sockaddr;