Example #1
0
    def GetPeerList(self, request, context):
        """현재 RadioStation 에 접속된 Peer 목록을 구한다.

        :param request: CommonRequest
        :param context:
        :return: PeerList
        """
        try:
            peer_list_dump = self.__peer_manager.dump()
        except pickle.PicklingError as e:
            logging.warning("fail peer_list dump")
            peer_list_dump = b''

        return loopchain_pb2.PeerList(peer_list=peer_list_dump)
Example #2
0
    def GetPeerList(self, request, context):
        """현재 RadioStation 에 접속된 Peer 목록을 구한다.

        :param request: CommonRequest
        :param context:
        :return: PeerList
        """
        channel_name = conf.LOOPCHAIN_DEFAULT_CHANNEL if not request.channel else request.channel
        try:
            peer_list_dump = ObjectManager(
            ).rs_service.channel_manager.get_peer_manager(channel_name).dump()
        except pickle.PicklingError as e:
            logging.warning("fail peer_list dump")
            peer_list_dump = b''

        return loopchain_pb2.PeerList(peer_list=peer_list_dump)
    def GetPeerList(self, request, context):
        """현재 RadioStation 에 접속된 Peer 목록을 구한다.

        :param request: CommonRequest
        :param context:
        :return: PeerList
        """
        channel_manager = ObjectManager().rs_service.channel_manager
        channel_name = conf.LOOPCHAIN_DEFAULT_CHANNEL if not request.channel else request.channel

        if channel_name in channel_manager.get_channel_list():
            peer_manager: PeerManager = channel_manager.get_peer_manager(channel_name)
            peer_list_dumped = peer_manager.peer_list_data.dump()
        else:
            peer_list_dumped = PeerListData().dump()

        return loopchain_pb2.PeerList(
            peer_list=peer_list_dumped
        )