Created
February 28, 2015 15:02
-
-
Save andriy-s/ac502e1d27ba4f19912d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- core/server.py.orig 2015-02-28 16:34:33.000000000 +0200 | |
+++ core/server.py 2015-02-28 16:45:24.000000000 +0200 | |
@@ -178,7 +178,12 @@ | |
if not self._address_info or (datetime.now() - self._address_info_resolved_time).seconds > ADDRESS_INFO_REFRESH_TIME: | |
# converts addresses tuple to list and adds a 6th parameter for availability (None = not checked, True = available, False=not available) and a 7th parameter for the checking time | |
try: | |
- self._address_info = [list(address) + [None, None] for address in socket.getaddrinfo(self.host, self.port, socket.AF_UNSPEC, socket.SOCK_STREAM, socket.IPPROTO_TCP, socket.AI_ADDRCONFIG | socket.AI_V4MAPPED)] | |
+ try: | |
+ self._address_info = [list(address) + [None, None] for address in socket.getaddrinfo(self.host, self.port, socket.AF_UNSPEC, socket.SOCK_STREAM, socket.IPPROTO_TCP, socket.AI_ADDRCONFIG | socket.AI_V4MAPPED)] | |
+ except socket.gaierror as e: | |
+ if e.errno != socket.EAI_BADFLAGS: | |
+ raise | |
+ self._address_info = [list(address) + [None, None] for address in socket.getaddrinfo(self.host, self.port, socket.AF_UNSPEC, socket.SOCK_STREAM, socket.IPPROTO_TCP, socket.AI_ADDRCONFIG)] | |
self._address_info_resolved_time = datetime.now() | |
except Exception: | |
self._address_info = [] |
Giovanni,
I ran into the same issue on FreeBSD. Your patch works for me.
Thanks,
Erik
Hello and sorry for late reply.
I've just tested your new implementation of the address_info property, and it appears to work fine for me.
Thanks,
Andriy.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, sorry but I've not tested with freeBSD.
I've slightly modified your patch, can you to substitute the address_info() property with the following code in the server.py?
Let me know if this works. It tries with the flags and if get a gaierror or the addresses list is empty (because of the AI_ADDRCONFIG) it tries without any flags.
Thanks,
Giovanni