def _handleReadableIncoming(self, inc):
        try:
            rdata = inc.socket.recv(inc.remainingSize())
            inc.failCount = 0
        except socket.error as e:
            inc.failCount = getattr(inc, 'failCount', 0) + 1
            if err_recv_inprogress(e.errno) and inc.failCount < MAX_CONSECUTIVE_READ_FAILURES:
                inc.backoffPause(True)
                return inc
            inc.close()
            return None
        if not rdata:
            # Since this point is only arrived at when select() says
            # the socket is readable, this is an indicator of a closed
            # socket.  Since previous calls didn't detect
            # receivedAllData(), this is an aborted/incomplete
            # reception.  Discard it.
            inc.close()
            return None
        inc.addData(rdata)
        return self._addedDataToIncoming(inc)
dataset/ETHPy150Open godaddy/Thespian/thespian/system/transport/TCPTransport.py/TCPTransport._handleReadableIncoming/original