[CalendarServer-changes] [10950] CalendarServer/trunk/twistedcaldav/scheduling/ischedule/utils.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Mar 19 12:11:38 PDT 2013
Revision: 10950
http://trac.calendarserver.org//changeset/10950
Author: sagen at apple.com
Date: 2013-03-19 12:11:38 -0700 (Tue, 19 Mar 2013)
Log Message:
-----------
Use AF_UNSPEC rather than iterating (socket.AF_INET, socket.AF_INET6) because getaddrinfo() will raise an exception if no match is found for the specified family
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/scheduling/ischedule/utils.py
Modified: CalendarServer/trunk/twistedcaldav/scheduling/ischedule/utils.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/ischedule/utils.py 2013-03-19 05:22:24 UTC (rev 10949)
+++ CalendarServer/trunk/twistedcaldav/scheduling/ischedule/utils.py 2013-03-19 19:11:38 UTC (rev 10950)
@@ -41,10 +41,13 @@
@return: a C{set} of IPs
"""
ips = set()
- for family in (socket.AF_INET, socket.AF_INET6):
- results = socket.getaddrinfo(host, None, family, socket.SOCK_STREAM)
- for _ignore_family, _ignore_socktype, _ignore_proto, _ignore_canonname, sockaddr in results:
- ips.add(sockaddr[0])
+ # Use AF_UNSPEC rather than iterating (socket.AF_INET, socket.AF_INET6)
+ # because getaddrinfo() will raise an exception if no match is found for
+ # the specified family
+ # TODO: potentially use twext.internet.gaiendpoint instead
+ results = socket.getaddrinfo(host, None, socket.AF_UNSPEC, socket.SOCK_STREAM)
+ for _ignore_family, _ignore_socktype, _ignore_proto, _ignore_canonname, sockaddr in results:
+ ips.add(sockaddr[0])
return ips
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130319/a9fddd10/attachment.html>
More information about the calendarserver-changes
mailing list