Use ipv6 socket when requested

This commit is contained in:
Cédric de Saint Martin 2011-06-24 18:30:11 +02:00
parent c659bcb79e
commit d473f4b6d1
1 changed files with 6 additions and 2 deletions

View File

@ -686,8 +686,12 @@ Sec-WebSocket-Accept: %s\r
is a WebSockets client then call new_client() method (which must
be overridden) for each new client connection.
"""
lsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
lsock = None
if self.ipv6:
socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
else:
socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
lsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
lsock.bind((self.listen_host, self.listen_port))
lsock.listen(100)