Currently calling Connection.sendall can cause a loop which re-sends data because __iowait will keep calling _connection.sendall with the same buffer, even if part of it has already been sent.
The fix, I believe, is to have a custom implementation of sendall which loops calling send, something like this:
def sendall(self, buf, flags=0):
while buf:
sent = self.send(buf, flags)
buf = buf[sent:]
(albeit with the extra fiddly bits to make sure it works correctly for memoryview and buffer objects)
See also: gevent/gevent#736
Currently calling
Connection.sendallcan cause a loop which re-sends data because__iowaitwill keep calling_connection.sendallwith the same buffer, even if part of it has already been sent.The fix, I believe, is to have a custom implementation of
sendallwhich loops callingsend, something like this:(albeit with the extra fiddly bits to make sure it works correctly for
memoryviewandbufferobjects)See also: gevent/gevent#736