diff options
author | Marcos Pinto <markybob@dipconsultants.com> | 2007-10-15 01:53:42 +0000 |
---|---|---|
committer | Marcos Pinto <markybob@dipconsultants.com> | 2007-10-15 01:53:42 +0000 |
commit | 7d98d4980332e641d9d61360cf2745226e9832f1 (patch) | |
tree | da2a5d47647d8d636662fd4aac77ffc690cd4acb | |
parent | f20d0485c39006855c436abb62fa3bfdbd969146 (diff) | |
download | deluge-7d98d4980332e641d9d61360cf2745226e9832f1.tar.gz deluge-7d98d4980332e641d9d61360cf2745226e9832f1.tar.bz2 deluge-7d98d4980332e641d9d61360cf2745226e9832f1.zip |
account for xp, which has a higher half-open allotment
-rw-r--r-- | src/deluge_core.cpp | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp index 881d7a5a0..630e1aef7 100644 --- a/src/deluge_core.cpp +++ b/src/deluge_core.cpp @@ -372,7 +372,17 @@ static PyObject *torrent_init(PyObject *self, PyObject *args) M_settings->user_agent = std::string(user_agent); #if defined(_WIN32) + DWORD windows_version = ::GetVersion(); + if ((windows_version & 0xff) >= 6) + { + // on vista the limit is 5 (in home edition) M_ses->set_max_half_open_connections(4); + } + else + { + // on XP SP2 it's 10 + M_ses->set_max_half_open_connections(8); + } #endif M_ses->set_download_rate_limit(-1); @@ -474,10 +484,31 @@ static PyObject *torrent_set_max_half_open(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "i", &arg)) return NULL; #if defined(_WIN32) - if (arg > 8) - arg = 4; - if (arg = -1) - arg = 4; + DWORD windows_version = ::GetVersion(); + if ((windows_version & 0xff) >= 6) + { + // on vista the limit is 5 (in home edition) + if (arg > 4) + { + arg = 4; + } + else if (arg = -1) + { + arg = 4; + } + } + else + { + // on XP SP2 it's 10 + if (arg > 8) + { + arg = 8; + } + else if (arg = -1) + { + arg = 8; + } + } #endif M_ses->set_max_half_open_connections(arg); |