Skip to content

Commit

Permalink
Merge pull request #551 from minrk/reuseaddr
Browse files Browse the repository at this point in the history
Don't set SO_REUSEADDR on Windows
  • Loading branch information
bdarnell committed Jun 29, 2012
2 parents a240c76 + 8e2f3b8 commit cfd7a96
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tornado/netutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ def bind_sockets(port, address=None, family=socket.AF_UNSPEC, backlog=128):
af, socktype, proto, canonname, sockaddr = res
sock = socket.socket(af, socktype, proto)
set_close_exec(sock.fileno())
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
if os.name != 'nt':
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
if af == socket.AF_INET6:
# On linux, ipv6 sockets accept ipv4 too by default,
# but this makes it impossible to bind to both
Expand Down

0 comments on commit cfd7a96

Please sign in to comment.