Example #1
0
 def remove_peer_by_target(self, channel_manager, peer_target):
     for group_id in list(self.peer_list.keys()):
         for peer_id in list(self.peer_list[group_id]):
             peer_each = self.peer_list[group_id][peer_id]
             if peer_each.target == peer_target:
                 self.remove_peer(peer_id, group_id)
                 message = loopchain_pb2.PeerID(peer_id=peer_id,
                                                channel=self.__channel_name,
                                                group_id=group_id)
                 channel_manager.broadcast(self.__channel_name,
                                           "AnnounceDeletePeer", message)
                 channel_manager.remove_audience(
                     channel=self.__channel_name, peer_target=peer_target)
Example #2
0
    def check_peer_status(self):
        """service loop for status heartbeat check to peer list

        :return:
        """
        time.sleep(conf.SLEEP_SECONDS_IN_RADIOSTATION_HEARTBEAT)

        delete_peer_list = self.__peer_manager.check_peer_status()

        for delete_peer in delete_peer_list:
            logging.debug(f"delete peer {delete_peer.peer_id}")
            message = loopchain_pb2.PeerID(peer_id=delete_peer.peer_id, group_id=delete_peer.group_id)
            self.__common_service.broadcast("AnnounceDeletePeer", message)
Example #3
0
    def check_peer_status(self):
        """service loop for status heartbeat check to peer list

        :return:
        """
        time.sleep(conf.SLEEP_SECONDS_IN_RADIOSTATION_HEARTBEAT)
        util.logger.spam(f"rs_service:check_peer_status(Heartbeat.!.!) for reset Leader and delete no response Peer")

        for channel in self.__channel_manager.get_channel_list():
            delete_peer_list = self.__channel_manager.get_peer_manager(channel).check_peer_status()

            for delete_peer in delete_peer_list:
                logging.debug(f"delete peer {delete_peer.peer_id}")
                message = loopchain_pb2.PeerID(
                    peer_id=delete_peer.peer_id,
                    channel=channel,
                    group_id=delete_peer.group_id)
                self.__common_service.broadcast("AnnounceDeletePeer", message)
Example #4
0
    def check_peer_status(self, channel):
        """service loop for status heartbeat check to peer list

        :return:
        """
        util.logger.spam(
            f"rs_service:check_peer_status(Heartbeat...{channel}) "
            f"for reset Leader and delete no response Peer")

        peer_manager = self.__channel_manager.get_peer_manager(channel)
        delete_peer_list = peer_manager.check_peer_status()

        for delete_peer in delete_peer_list:
            logging.debug(f"delete peer {delete_peer.peer_id}")
            message = loopchain_pb2.PeerID(peer_id=delete_peer.peer_id,
                                           channel=channel,
                                           group_id=delete_peer.group_id)
            self.__channel_manager.broadcast(channel, "AnnounceDeletePeer",
                                             message)

        # save current peer_manager after heartbeat to peers.
        ObjectManager().rs_service.admin_manager.save_peer_manager(
            channel, peer_manager)