TCP IPv6: fix leaking sockets

This commit is contained in:
Thomas Kriechbaumer 2017-05-24 10:34:56 +02:00
parent 1ca98c83aa
commit ba05a29fbb
1 changed files with 2 additions and 0 deletions

View File

@ -864,6 +864,8 @@ class TCPServer:
self.socket.setsockopt(IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
self.socket.bind(self.address)
except socket.error:
if self.socket:
self.socket.close()
self.socket = None
if not self.socket: