From 6395754b4a6a25e516879751816b2c80e916ab5a Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Sun, 13 Sep 2015 22:45:45 +0200 Subject: [PATCH] Fix isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections on BSD Examples: NetBSD: >>> print platform.version() NetBSD 7.99.21 (GENERIC) #1: Sun Sep 13 01:23:14 CEST 2015 root@chieftec:/tmp/netbsd-tmp/sys/arch/amd64/compile/GENERIC >>> print platform.release() 7.99.21 OpenBSD: >>> print platform.version() GENERIC#738 >>> print platform.release() 5.7 FreeBSD: >>> print platform.version() FreeBSD 11.0-CURRENT #0 r285794: Thu Jul 23 00:39:41 UTC 2015 root@releng2.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/RPI2 >>> print platform.release() 11.0-CURRENT --- src/helper_startup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/helper_startup.py b/src/helper_startup.py index 778fe70a..58caecc2 100644 --- a/src/helper_startup.py +++ b/src/helper_startup.py @@ -140,8 +140,11 @@ def loadConfig(): def isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections(): try: - VER_THIS=StrictVersion(platform.version()) if sys.platform[0:3]=="win": + # This check won't work on BSD platforms, replacing it with + # platform.release() still won't be portable, as e.g. FreeBSD might + # return '11.0-CURRENT'. Leave the version check for Windows only. + VER_THIS=StrictVersion(platform.version()) return StrictVersion("5.1.2600")<=VER_THIS and StrictVersion("6.0.6000")>=VER_THIS return False except Exception as err: