]> granicus.if.org Git - python/commitdiff
fix send method not noticing when partial sends happen
authorPiers Lauder <piers@cs.su.oz.au>
Sun, 21 Oct 2001 20:26:37 +0000 (20:26 +0000)
committerPiers Lauder <piers@cs.su.oz.au>
Sun, 21 Oct 2001 20:26:37 +0000 (20:26 +0000)
Lib/imaplib.py

index 005cf16019f80eb1e9c63a65393d78c01da45b38..204148bc8e75de8be25fdace1370482f8b03bd28 100644 (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):