#14758: add IPv6 support to smtpd.

Patch by Milan Oberkirch.
This commit is contained in:
R David Murray 2014-06-11 13:48:58 -04:00
parent 1144da5821
commit 6fe56a329d
5 changed files with 58 additions and 15 deletions

View file

@ -610,7 +610,8 @@ class SMTPServer(asyncore.dispatcher):
self._decode_data = decode_data
asyncore.dispatcher.__init__(self, map=map)
try:
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
gai_results = socket.getaddrinfo(*localaddr)
self.create_socket(gai_results[0][0], gai_results[0][1])
# try to re-use a server port if possible
self.set_reuse_addr()
self.bind(localaddr)