Issue 4929: Handle socket errors when receiving
This commit is contained in:
parent
a200dd5584
commit
51a035e383
|
@ -334,7 +334,10 @@ class SMTP:
|
|||
if self.file is None:
|
||||
self.file = self.sock.makefile('rb')
|
||||
while 1:
|
||||
line = self.file.readline()
|
||||
try:
|
||||
line = self.file.readline()
|
||||
except socket.error:
|
||||
line = ''
|
||||
if line == '':
|
||||
self.close()
|
||||
raise SMTPServerDisconnected("Connection unexpectedly closed")
|
||||
|
|
Loading…
Reference in New Issue