Determine windows version reliably

Fixes #9578
This commit is contained in:
Philipp Hörist 2019-02-15 16:56:52 +01:00
parent 064f249c5a
commit f4b4e9cc88
1 changed files with 1 additions and 2 deletions

View File

@ -26,7 +26,6 @@ from gajim.common.zeroconf import zeroconf
from nbxmpp.protocol import *
import socket
import platform
import ssl
import errno
import sys
@ -73,7 +72,7 @@ class ZeroconfListener(IdleObject):
self._serv.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
self._serv.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
if os.name == 'nt':
if int(platform.win32_ver()[0]) >= 6: # Win Vista +
if sys.getwindowsversion().major >= 6: # Win Vista +
# 47 is socket.IPPROTO_IPV6
# 27 is socket.IPV6_V6ONLY under windows, but not defined ...
self._serv.setsockopt(41, 27, 0)