def _forward(self, src, dst, direction):
        assert direction in ('w', 'r')

        while True:
            try:
                data = src.recv(self.chunk_size)
            except socket.error as e:
                if e.args and e.args[0] == 'timed out':
                    self.logger.debug('%s TIMEOUT' % direction)
                    return
            if not data:
                self.logger.debug('%s EOF' % direction)
                return
            self.logger.debug('%s %r bytes' % (direction, len(data)))
            dst.sendall(data)
dataset/ETHPy150Open tonyseek/rsocks/rsocks/server.py/ReverseProxyServer._forward/original