Skip to content

Commit

Permalink
Fixed error in HTTPServer when AI_ADDRCONFIG is not available (as on …
Browse files Browse the repository at this point in the history
…WinXP)

Closes tornadoweb#287
  • Loading branch information
bdarnell committed Jun 26, 2011
1 parent 5fde3f5 commit 84acb20
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tornado/httpserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,15 @@ def bind(self, port, address=None, family=socket.AF_UNSPEC):
"""
if address == "":
address = None
flags = socket.AI_PASSIVE
if hasattr(socket, "AI_ADDRCONFIG"):
# AI_ADDRCONFIG ensures that we only try to bind on ipv6
# if the system is configured for it, but the flag doesn't
# exist on some platforms (specifically WinXP, although
# newer versions of windows have it)
flags |= socket.AI_ADDRCONFIG
for res in socket.getaddrinfo(address, port, family, socket.SOCK_STREAM,
0, socket.AI_PASSIVE | socket.AI_ADDRCONFIG):
0, flags):
af, socktype, proto, canonname, sockaddr = res
sock = socket.socket(af, socktype, proto)
flags = fcntl.fcntl(sock.fileno(), fcntl.F_GETFD)
Expand Down
1 change: 1 addition & 0 deletions website/sphinx/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Release notes
.. toctree::
:maxdepth: 2

releases/next
releases/v2.0.0
releases/v1.2.1
releases/v1.2.0
Expand Down
11 changes: 11 additions & 0 deletions website/sphinx/releases/next.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
What's new in the next release of Tornado
=========================================

In progress
-----------

Bug fixes
~~~~~~~~~

* `HTTPServer`: fixed exception at startup when ``socket.AI_ADDRCONFIG`` is
not available, as on Windows XP

0 comments on commit 84acb20

Please sign in to comment.