mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 16:48:06 +02:00
port of 1.4.4 rev. 19278 (fixed SF# 3475050)
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user