Issue #16647: save socket error details in LMTP.connect()
Patch by Serhiy Storchaka.
This commit is contained in:
commit
3b69824de9
|
@ -920,13 +920,13 @@ class LMTP(SMTP):
|
||||||
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||||
self.file = None
|
self.file = None
|
||||||
self.sock.connect(host)
|
self.sock.connect(host)
|
||||||
except socket.error as msg:
|
except socket.error:
|
||||||
if self.debuglevel > 0:
|
if self.debuglevel > 0:
|
||||||
print('connect fail:', host, file=stderr)
|
print('connect fail:', host, file=stderr)
|
||||||
if self.sock:
|
if self.sock:
|
||||||
self.sock.close()
|
self.sock.close()
|
||||||
self.sock = None
|
self.sock = None
|
||||||
raise socket.error(msg)
|
raise
|
||||||
(code, msg) = self.getreply()
|
(code, msg) = self.getreply()
|
||||||
if self.debuglevel > 0:
|
if self.debuglevel > 0:
|
||||||
print('connect:', msg, file=stderr)
|
print('connect:', msg, file=stderr)
|
||||||
|
|
Loading…
Reference in New Issue