示例#1
0
 void send_to_acquaintances(const any_tuple& what) {
     // send to all remote subscribers
     auto sender = last_sender();
     CPPA_LOG_DEBUG("forward message to " << m_acquaintances.size()
                    << " acquaintances; " << CPPA_TSARG(sender)
                    << ", " << CPPA_TSARG(what));
     for (auto& acquaintance : m_acquaintances) {
         acquaintance->enqueue({sender, acquaintance}, what);
     }
 }
示例#2
0
void local_actor::forward_message(const actor_ptr& new_receiver) {
    if (new_receiver == nullptr) {
        return;
    }
    auto& from = last_sender();
    auto id = m_current_node->mid;
    if (id.valid() == false || id.is_response()) {
        new_receiver->enqueue(from.get(), m_current_node->msg);
    }
    else {
        new_receiver->sync_enqueue(from.get(), id, m_current_node->msg);
        // treat this message as asynchronous message from now on
        m_current_node->mid = message_id_t();
    }
}
示例#3
0
void local_actor::reply_message(any_tuple&& what) {
    auto& whom = last_sender();
    if (whom == nullptr) {
        return;
    }
    auto id = m_current_node->mid;
    if (id.valid() == false || id.is_response()) {
        send_message(whom.get(), std::move(what));
    }
    else if (chaining_enabled()) {
        if (whom->chained_sync_enqueue(this, id.response_id(), std::move(what))) {
            m_chained_actor = whom;
        }
    }
    else whom->sync_enqueue(this, id.response_id(), std::move(what));
}