From 85ea737b0d9e98854b8c10d274b37990307067a8 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Tue, 7 Oct 2008 08:54:19 +0000 Subject: [PATCH] Changed max half-open connections default limit to 8 on XP/2000 and 4 on Vista --- deluge/common.py | 7 +++++++ deluge/core/preferencesmanager.py | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/deluge/common.py b/deluge/common.py index 91259e45d..cba7cd12a 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -123,6 +123,13 @@ def windows_check(): else: return False +def vista_check(): + import platform + if platform.release() == "Vista": + return True + else: + return False + def get_pixmap(fname): """Returns a pixmap file included with deluge""" return pkg_resources.resource_filename("deluge", os.path.join("data", \ diff --git a/deluge/core/preferencesmanager.py b/deluge/core/preferencesmanager.py index 7f915f398..865489629 100644 --- a/deluge/core/preferencesmanager.py +++ b/deluge/core/preferencesmanager.py @@ -69,7 +69,8 @@ DEFAULT_PREFS = { "max_upload_speed": -1.0, "max_download_speed": -1.0, "max_upload_slots_global": 4, - "max_half_open_connections": -1, + "max_half_open_connections": (lambda: deluge.common.windows_check() and + (lambda: deluge.common.vista_check() and 4 or 8)() or -1)(), "max_connections_per_second": 20, "ignore_limits_on_local_network": True, "max_connections_per_torrent": -1,