Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0402dd1

Browse files
author
Piers Lauder
committed
fix send method not noticing when partial sends happen
1 parent 1296a8d commit 0402dd1

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Lib/imaplib.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,13 @@ def readline(self):
222222

223223
def send(self, data):
224224
"""Send data to remote."""
225-
self.sock.send(data)
225+
bytes = len(data)
226+
while bytes > 0:
227+
sent = self.sock.send(data)
228+
if sent == bytes:
229+
break # avoid copy
230+
data = data[sent:]
231+
bytes = bytes - sent
226232

227233

228234
def shutdown(self):

0 commit comments

Comments
 (0)