def recv_generator(self, conn):
        msg = ''
        while True:
            new_data = conn.recv(32)
            if new_data == '': # If connection failed, close it
                self.finger.remove(self.Node)
                self.remote_conn.close()
                break
            msg += new_data
            if '|' in msg:
                length, remainder = msg.split('|', 1)
                length = int(length)
                if len(remainder) < length:
                    continue
                
                yield remainder[0:length]
                msg = remainder[length:len(remainder)]
dataset/ETHPy150Open c00w/gevent-dht/gevent_dht/protocol.py/Protocol.recv_generator/original