port of 1.4.4 rev. 19278 (fixed SF# 3475050)

This commit is contained in:
Aleksandar Fabijanic
2012-08-23 03:27:44 +00:00
parent 2a6d58c7f2
commit 91b3ca4421

View File

@@ -271,21 +271,13 @@ void DNS::aierror(int code, const std::string& arg)
} }
#if defined(_WIN32)
static Poco::AtomicCounter initializeCount;
#endif
void initializeNetwork() void initializeNetwork()
{ {
#if defined(_WIN32) #if defined(_WIN32)
if (++initializeCount == 1) WORD version = MAKEWORD(2, 2);
{ WSADATA data;
WORD version = MAKEWORD(2, 2); if (WSAStartup(version, &data) != 0)
WSADATA data; throw NetException("Failed to initialize network subsystem");
if (WSAStartup(version, &data) != 0)
throw NetException("Failed to initialize network subsystem");
}
#endif // _WIN32 #endif // _WIN32
} }
@@ -293,10 +285,7 @@ void initializeNetwork()
void uninitializeNetwork() void uninitializeNetwork()
{ {
#if defined(_WIN32) #if defined(_WIN32)
if (--initializeCount == 0) WSACleanup();
{
WSACleanup();
}
#endif // _WIN32 #endif // _WIN32
} }