fix send method not noticing when partial sends happen

This commit is contained in:
Piers Lauder 2001-10-21 20:26:37 +00:00
parent 1296a8d77e
commit 0402dd18cb
1 changed files with 7 additions and 1 deletions

View File

@ -222,7 +222,13 @@ class IMAP4:
def send(self, data):
"""Send data to remote."""
self.sock.send(data)
bytes = len(data)
while bytes > 0:
sent = self.sock.send(data)
if sent == bytes:
break # avoid copy
data = data[sent:]
bytes = bytes - sent
def shutdown(self):