If IPv4 bind but IPv6 succeeds don't error.

This commit is contained in:
Brian May 2014-09-15 14:32:59 +10:00
parent a33f6199c4
commit c013386ecb

View File

@ -209,7 +209,15 @@ class MultiListener:
if self.v6:
self.v6.listen(backlog)
if self.v4:
self.v4.listen(backlog)
try:
self.v4.listen(backlog)
except socket.error, e:
# on some systems v4 bind will fail if the v6 suceeded,
# in this case the v6 socket will receive v4 too.
if e.errno == errno.EADDRINUSE and self.v6:
self.v4 = None
else:
raise e
def bind(self, address_v6, address_v4):
if address_v6 and self.v6: