- win32 winsock bugfixes causing havok and grief for win32 users (corrupt winsock stack due to extra call to wsacleanup)

This commit is contained in:
Mark Vejvoda
2011-01-17 23:45:09 +00:00
parent d8e28fbf90
commit 9ba8668751
6 changed files with 31 additions and 11 deletions

View File

@@ -214,17 +214,20 @@ bool UPNP_Tools::enabledUPNP = false;
return acErrorBuffer;
}
//SocketManager Socket::socketManager;
// keeps in scope for duration of the application
SocketManager Socket::wsaManager;
SocketManager::SocketManager() {
WSADATA wsaData;
WORD wVersionRequested = MAKEWORD(2, 0);
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("SocketManager calling WSAStartup...\n");
WSAStartup(wVersionRequested, &wsaData);
//dont throw exceptions here, this is a static initializacion
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"Winsock initialized.\n");
}
SocketManager::~SocketManager() {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("SocketManager calling WSACleanup...\n");
WSACleanup();
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"Winsock cleanup complete.\n");
}