def ping_neighbor(self):
        """used to ping neighbors periodically"""
        # Only ping neighbors that didn't send a message recently
        while True:
            # Check nodeliveness
            for peer in self.replicas:
                if peer == self.me:
                    continue
                if peer in self.nodeliveness:
                    nosound = time.time() - self.nodeliveness[peer]
                else:
                    nosound = LIVENESSTIMEOUT + 1

                if nosound <= LIVENESSTIMEOUT:
                    # Peer is alive
                    self.replicas[peer] = 0
                    continue
                if nosound > LIVENESSTIMEOUT:
                    # Send PING to node
                    if self.debug: self.logger.write("State", "Sending PING to %s" % str(peer))
                    pingmessage = create_message(MSG_PING, self.me)
                    successid = self.send(pingmessage, peer=peer)
                if successid < 0 or nosound > (2*LIVENESSTIMEOUT):
                    # Neighbor not responding, mark the neighbor
                    if self.debug: self.logger.write("State",
                                                     "Neighbor not responding")
                    self.replicas[peer] += 1
            time.sleep(LIVENESSTIMEOUT)
dataset/ETHPy150Open denizalti/concoord/concoord/node.py/Node.ping_neighbor/original