Browse files

Merge pull request #551 from minrk/reuseaddr

Don't set SO_REUSEADDR on Windows
  • Loading branch information...
2 parents a240c76 + 8e2f3b8 commit cfd7a96c7e93c1bed28cca2c556680b1cc5fd537 @bdarnell bdarnell committed Jun 29, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 tornado/netutil.py
View
3 tornado/netutil.py
@@ -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

0 comments on commit cfd7a96

Please sign in to comment.