mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 17:30:44 +02:00
workaround for vista service automatic WSAStartup() crash issue
This commit is contained in:
@@ -50,7 +50,7 @@ using Poco::IOException;
|
||||
//
|
||||
// Automatic initialization of Windows networking
|
||||
//
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) && !defined(POCO_NET_NO_AUTOMATIC_WSASTARTUP)
|
||||
namespace
|
||||
{
|
||||
class NetworkInitializer
|
||||
@@ -58,14 +58,12 @@ namespace
|
||||
public:
|
||||
NetworkInitializer()
|
||||
{
|
||||
WORD version = MAKEWORD(2, 2);
|
||||
WSADATA data;
|
||||
WSAStartup(version, &data);
|
||||
Poco::Net::initializeNetwork();
|
||||
}
|
||||
|
||||
~NetworkInitializer()
|
||||
{
|
||||
WSACleanup();
|
||||
Poco::Net::uninitializeNetwork();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -236,4 +234,22 @@ void DNS::error(int code, const std::string& arg)
|
||||
}
|
||||
|
||||
|
||||
void initializeNetwork()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
WORD version = MAKEWORD(2, 2);
|
||||
WSADATA data;
|
||||
WSAStartup(version, &data);
|
||||
#endif // _WIN32
|
||||
}
|
||||
|
||||
|
||||
void uninitializeNetwork()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
WSACleanup();
|
||||
#endif // _WIN32
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
||||
Reference in New Issue
Block a user