bus.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:trellio 作者: artificilabs 项目源码 文件源码
def _request_sender(self, packet: dict):
        """
        Sends a request to a server from a ServiceClient
        auto dispatch method called from self.send()
        """
        node_id = self._get_node_id_for_packet(packet)
        client_protocol = self._client_protocols.get(node_id)
        if node_id and client_protocol:
            if client_protocol.is_connected():
                packet['to'] = node_id
                client_protocol.send(packet)
                return True
            else:
                self._logger.error('Client protocol is not connected for packet %s', packet)
                raise ClientDisconnected()
        else:
            # No node found to send request
            self._logger.error('Out of %s, Client Not found for packet %s, restarting server...',
                               self._client_protocols.keys(), packet)
            raise ClientNotFoundError()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号