Commit ca9d8cea authored by Denis Bilenko's avatar Denis Bilenko

Fix issue #150: Do not wait for write event in...

Fix issue #150: Do not wait for write event in gevent.fileobject.SocketAdapter.sendall() if everything was written already. Based on patch by Mark Hingston.
parent 68f60760
......@@ -96,7 +96,7 @@ else:
fileno = self.fileno()
bytes_total = len(data)
bytes_written = 0
while bytes_written < bytes_total:
while True:
try:
bytes_written += _write(fileno, _get_memory(data, bytes_written))
except (IOError, OSError):
......@@ -104,6 +104,8 @@ else:
if code not in ignored_errors:
raise
sys.exc_clear()
if bytes_written >= bytes_total:
return
self.hub.wait(self._write_event)
def recv(self, size):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment