Catch UnicodeError in IRC gethostbyname

Fixes #68
This commit is contained in:
Neil Booth 2016-12-10 08:01:13 +09:00
parent c523064632
commit b8239c54d9

View File

@ -156,11 +156,12 @@ class IRC(LoggedClass):
try:
ip_addr = socket.gethostbyname(line[1])
except socket.error:
# No IPv4 address could be resolved. Could be .onion or IPv6.
# Could be .onion or IPv6.
ip_addr = line[1]
peer = self.Peer(ip_addr, line[1], line[2:])
self.peers[nick] = peer
except IndexError:
except (IndexError, UnicodeError):
# UnicodeError comes from invalid domains (issue #68)
pass