示例#1
0
    def send_to_sender(self, sender, packet):
        if sender is None:
            self.callback(packet)
            return

        if packet.binary_data:
            binary_data_pointer = serialize_binary_data(packet.binary_data)
        else:
            binary_data_pointer = None
        self.operator_cl.response_to_sender(sender, packet.message_id, \
                        packet.ret_code, packet.ret_message, packet.ret_parameters,\
                        binary_data_pointer)
示例#2
0
    def _init_operation(self, node_address, operation, parameters, sync=False, binary_data=''):
        """Initiate new operation"""
        if sync:
            req = FabnetPacketRequest(method=operation, sender=self.self_address, \
                    parameters=parameters, binary_data=binary_data, sync=sync)
            return self.__fri_client.call_sync(node_address, req)

        if binary_data:
            binary_data_pointer = serialize_binary_data(binary_data)
        else:
            binary_data_pointer = None

        message_id = self.operator.async_remote_call(node_address, operation, parameters, \
                        False, binary_data_pointer)
        return message_id