Revert "greenio: Remove sendall-like semantincs from GreenSocket.send"
On Travis CI it breaks the build with:
======================================================================
FAIL: test_multiple_readers (tests.greenio_test.TestGreenIoLong)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/eventlet/eventlet/tests/__init__.py", line 71, in wrapped
    return func(*a, **kw)
  File "/home/travis/build/eventlet/eventlet/tests/greenio_test.py", line 836, in test_multiple_readers
    assert len(results2) > 0
AssertionError
This reverts commit 4656eadfa5.
			
			
This commit is contained in:
		@@ -351,20 +351,28 @@ class GreenSocket(object):
 | 
			
		||||
        if self.act_non_blocking:
 | 
			
		||||
            return fd.send(data, flags)
 | 
			
		||||
 | 
			
		||||
        # blocking socket behavior - sends all, blocks if the buffer is full
 | 
			
		||||
        total_sent = 0
 | 
			
		||||
        len_data = len(data)
 | 
			
		||||
        while 1:
 | 
			
		||||
            try:
 | 
			
		||||
                return fd.send(data, flags)
 | 
			
		||||
                total_sent += fd.send(data[total_sent:], flags)
 | 
			
		||||
            except socket.error as e:
 | 
			
		||||
                eno = get_errno(e)
 | 
			
		||||
                if eno == errno.ENOTCONN or eno not in SOCKET_BLOCKING:
 | 
			
		||||
                    raise
 | 
			
		||||
 | 
			
		||||
            if total_sent == len_data:
 | 
			
		||||
                break
 | 
			
		||||
 | 
			
		||||
            try:
 | 
			
		||||
                self._trampoline(self.fd, write=True, timeout=self.gettimeout(),
 | 
			
		||||
                                 timeout_exc=socket.timeout("timed out"))
 | 
			
		||||
            except IOClosed:
 | 
			
		||||
                raise socket.error(errno.ECONNRESET, 'Connection closed by another thread')
 | 
			
		||||
 | 
			
		||||
        return total_sent
 | 
			
		||||
 | 
			
		||||
    def sendall(self, data, flags=0):
 | 
			
		||||
        tail = self.send(data, flags)
 | 
			
		||||
        len_data = len(data)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user