Esempio n. 1
0
bool abstract_actor::link_impl(linking_operation op, const actor_addr& other) {
  CAF_LOG_TRACE(CAF_ARG(op) << ", " << CAF_TSARG(other));
  switch (op) {
    case establish_link_op:
      return establish_link_impl(other);
    case establish_backlink_op:
      return establish_backlink_impl(other);
    case remove_link_op:
      return remove_link_impl(other);
    default:
      CAF_ASSERT(op == remove_backlink_op);
      return remove_backlink_impl(other);
  }
}
bool forwarding_actor_proxy::link_impl(linking_operation op,
                                       abstract_actor* other) {
  switch (op) {
    case establish_link_op:
      if (establish_link_impl(other)) {
        // causes remote actor to link to (proxy of) other
        // receiving peer will call: this->local_link_to(other)
        forward_msg(ctrl(), invalid_message_id,
                    make_message(link_atom::value, other->address()));
        return true;
      }
      break;
    case remove_link_op:
      if (remove_link_impl(other)) {
        // causes remote actor to unlink from (proxy of) other
        forward_msg(ctrl(), invalid_message_id,
                    make_message(unlink_atom::value, other->address()));
        return true;
      }
      break;
    case establish_backlink_op:
      if (establish_backlink_impl(other)) {
        // causes remote actor to unlink from (proxy of) other
        forward_msg(ctrl(), invalid_message_id,
                    make_message(link_atom::value, other->address()));
        return true;
      }
      break;
    case remove_backlink_op:
      if (remove_backlink_impl(other)) {
        // causes remote actor to unlink from (proxy of) other
        forward_msg(ctrl(), invalid_message_id,
                    make_message(unlink_atom::value, other->address()));
        return true;
      }
      break;
  }
  return false;
}
bool remote_actor_proxy::link_impl(linking_operation op,
                                   const actor_addr& other) {
  switch (op) {
    case establish_link_op:
      if (establish_link_impl(other)) {
        // causes remote actor to link to (proxy of) other
        // receiving peer will call: this->local_link_to(other)
        forward_msg(address(), invalid_message_id,
                    make_message(atom("_Link"), other));
        return true;
      }
      return false;
    case remove_link_op:
      if (remove_link_impl(other)) {
        // causes remote actor to unlink from (proxy of) other
        forward_msg(address(), invalid_message_id,
                    make_message(atom("_Unlink"), other));
        return true;
      }
      return false;
    case establish_backlink_op:
      if (establish_backlink_impl(other)) {
        // causes remote actor to unlink from (proxy of) other
        forward_msg(address(), invalid_message_id,
                    make_message(atom("_Link"), other));
        return true;
      }
      return false;
    case remove_backlink_op:
      if (remove_backlink_impl(other)) {
        // causes remote actor to unlink from (proxy of) other
        forward_msg(address(), invalid_message_id,
                    make_message(atom("_Unlink"), other));
        return true;
      }
      return false;
  }
  return false;
}
void forwarding_actor_proxy::local_link_to(abstract_actor* other) {
  establish_link_impl(other);
}
void remote_actor_proxy::local_link_to(const actor_addr& other) {
  establish_link_impl(other);
}
void forwarding_actor_proxy::local_link_to(const actor_addr& other) {
  establish_link_impl(other);
}