SMTP.connect(): If the socket.connect() raises a socket.error, be sure
to call self.close() to reclaim some file descriptors, the reraise the exception. Closes SF patch #102185 and SF bug #119833.
This commit is contained in:
parent
8a41d20b05
commit
17bfef5860
|
@ -214,7 +214,11 @@ class SMTP:
|
|||
if not port: port = SMTP_PORT
|
||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
if self.debuglevel > 0: print 'connect:', (host, port)
|
||||
try:
|
||||
self.sock.connect((host, port))
|
||||
except socket.error:
|
||||
self.close()
|
||||
raise
|
||||
(code,msg)=self.getreply()
|
||||
if self.debuglevel >0 : print "connect:", msg
|
||||
return (code,msg)
|
||||
|
|
Loading…
Reference in New Issue