Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Don't set SO_REUSEADDR on Windows #551

Merged
merged 2 commits into from

3 participants

@minrk

Windows interprets REUSEADDR differently, allowing simultaneous instances.

EDIT: SO_EXCLUSIVEADDR is an alternative, but it seems like doing nothing is actually the best choice.

closes #550

@alekstorm

Checking sys.platform == 'win32' excludes some Windows versions. Try os.name == 'nt' instead.

@minrk

done.

@bdarnell bdarnell merged commit cfd7a96 into tornadoweb:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  tornado/netutil.py
View
3  tornado/netutil.py
@@ -252,7 +252,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
Something went wrong with that request. Please try again.