Commit 13f09271 authored by Denis Bilenko's avatar Denis Bilenko

Merge pull request #420 from fantix/socket_send

fix _socket3 send/sendall
parents dd798290 8534dced
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
import io import io
import time import time
from gevent import _socketcommon from gevent import _socketcommon
from gevent.hub import text_type
import _socket import _socket
from io import BlockingIOError from io import BlockingIOError
...@@ -288,15 +287,13 @@ class socket(_socket.socket): ...@@ -288,15 +287,13 @@ class socket(_socket.socket):
raise raise
self._wait(self._write_event) self._wait(self._write_event)
try: try:
return sock.send(data, flags) return _socket.socket.send(self, data, flags)
except error as ex2: except error as ex2:
if ex2.args[0] == EWOULDBLOCK: if ex2.args[0] == EWOULDBLOCK:
return 0 return 0
raise raise
def sendall(self, data, flags=0): def sendall(self, data, flags=0):
if isinstance(data, text_type):
data = data.encode()
if self.timeout is None: if self.timeout is None:
data_sent = 0 data_sent = 0
while data_sent < len(data): while data_sent < len(data):
......
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