#14758: Need to specify the desired socket type in the getaddrinfo call.

This worked by accident on Linux because the SOCK_STREAM was returned
first, but on the FreeBSD the SOCK_DGRAM is first in the list.
This commit is contained in:
R David Murray 2014-06-11 15:17:50 -04:00
parent 6ffface429
commit 012a83ab26
1 changed files with 2 additions and 1 deletions

View File

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