From 4453df7594244af66b81c733f8134f99e2cd9088 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Fri, 24 Jan 2014 19:13:39 +0100 Subject: [PATCH] network: Check for windows platform match --- mopidy/utils/network.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mopidy/utils/network.py b/mopidy/utils/network.py index adfe3b5f..20587eac 100644 --- a/mopidy/utils/network.py +++ b/mopidy/utils/network.py @@ -5,6 +5,7 @@ import gobject import logging import re import socket +import sys import threading import pykka @@ -43,9 +44,9 @@ def create_socket(): if has_ipv6: sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) # Explicitly configure socket to work for both IPv4 and IPv6 - if (hasattr(socket, 'IPPROTO_IPV6')): + if hasattr(socket, 'IPPROTO_IPV6'): sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0) - else: + elif sys.platform == 'win32': # also match 64bit windows. # Python 2.7 on windows does not have the IPPROTO_IPV6 constant # Use values extracted from Windows Vista/7/8's header sock.setsockopt(41, 27, 0)