summaryrefslogtreecommitdiffstats
path: root/Lib/smtpd.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-06-11 17:48:58 (GMT)
committerR David Murray <rdmurray@bitdance.com>2014-06-11 17:48:58 (GMT)
commit6fe56a329dd427f2a5363b43ad24f04785d2091d (patch)
treeaf2b051bbdb771ad2932d6888b9405d7984ff9b6 /Lib/smtpd.py
parent1144da5821553449739744f08d041b4ba7114ecb (diff)
downloadcpython-6fe56a329dd427f2a5363b43ad24f04785d2091d.zip
cpython-6fe56a329dd427f2a5363b43ad24f04785d2091d.tar.gz
cpython-6fe56a329dd427f2a5363b43ad24f04785d2091d.tar.bz2
#14758: add IPv6 support to smtpd.
Patch by Milan Oberkirch.
Diffstat (limited to 'Lib/smtpd.py')
-rwxr-xr-xLib/smtpd.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/smtpd.py b/Lib/smtpd.py
index 569b42e..d828c5f 100755
--- a/Lib/smtpd.py
+++ b/Lib/smtpd.py
@@ -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)