Limit the concurrent connection attempts in Windows XP. Its's only a hack.

Problem:
RetroShare connects to all ssl's at once. In Windows XP there is a build-in connection limit of concurrent incomplete connections.

Quote:
"The TCP/IP stack in Windows XP with Service Pack 2 (SP2) installed limits the number of concurrent, incomplete outbound TCP connection attempts. When the limit is reached, subsequent connection attempts are put in a queue and resolved at a fixed rate so that there are only a limited number of connections in the incomplete state."

This results in a high usage of the nonepaged pool and when it runs over the limit it results in the following error in the system log:
German:  "TCP/IP hat das Sicherheitslimit erreicht, das für die Anzahl gleichzeitiger TCP-Verbindungsversuche festgelegt wurde."
English: "TCP/IP has reached the security limit imposed on the number of concurrent (incomplete) TCP connect attempts."

After a longer runtime of RetroShare and a very high usage of the nonepaged pool all connections of all running programs are lost and no new connections can be made. At the end it can cause a blue screen.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3631 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-10-07 11:17:42 +00:00
parent c134b5f605
commit f4bbd3e933
6 changed files with 188 additions and 4 deletions

View file

@ -76,6 +76,7 @@ class RsInitConfig
static std::string homePath;
#ifdef WINDOWS_SYS
static bool portable;
static bool isWindowsXP;
#endif
static std::list<accountId> accountIds;
@ -169,6 +170,7 @@ std::string RsInitConfig::basedir;
std::string RsInitConfig::homePath;
#ifdef WINDOWS_SYS
bool RsInitConfig::portable = false;
bool RsInitConfig::isWindowsXP = false;
#endif
/* Listening Port */
@ -252,10 +254,38 @@ void RsInit::InitRsConfig()
#ifdef WINDOWS_SYS
// test for portable version
if (GetFileAttributes (L"gpg.exe") != (DWORD) -1 && GetFileAttributes (L"gpgme-w32spawn.exe") != (DWORD) -1) {
if (GetFileAttributes (L"gpg.exe") != (DWORD) -1 && GetFileAttributes (L"gpgme-w32spawn.exe") != (DWORD) -1) {
// use portable version
RsInitConfig::portable = true;
}
// test for Windows XP
OSVERSIONINFOEX osvi;
memset(&osvi, 0, sizeof(osvi));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if (GetVersionEx((OSVERSIONINFO*) &osvi)) {
if (osvi.dwMajorVersion == 5) {
if (osvi.dwMinorVersion == 1) {
/* Windows XP */
RsInitConfig::isWindowsXP = true;
} else if (osvi.dwMinorVersion == 2) {
SYSTEM_INFO si;
memset(&si, 0, sizeof(si));
GetSystemInfo(&si);
if (osvi.wProductType == VER_NT_WORKSTATION && si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64) {
/* Windows XP Professional x64 Edition */
RsInitConfig::isWindowsXP = true;
}
}
}
}
if (RsInitConfig::isWindowsXP) {
std::cerr << "Running Windows XP" << std::endl;
} else {
std::cerr << "Not running Windows XP" << std::endl;
}
#endif
/* Setup the Debugging */
@ -1988,6 +2018,15 @@ bool RsInit::isPortable()
#endif
}
bool RsInit::isWindowsXP()
{
#ifdef WINDOWS_SYS
return RsInitConfig::isWindowsXP;
#else
return false;
#endif
}
std::string RsInit::RsConfigDirectory()
{
return RsInitConfig::basedir;