Commit 7f3a8bee authored by Josh Kunz's avatar Josh Kunz

Make dispatch_invoke of RP_SEND use `cn_rp_send`

Previously, it was manually constructing the rp_elems and using
`cn_rp_send_elem` which would assume that the caller had set the send
type appropriately, dispatch was never updated to deal with membrane
types, this commit fixes that.
parent 8e63f304
Pipeline #1905 passed with stage
in 30 seconds
......@@ -1170,31 +1170,30 @@ int cn_dispatch_invoke(cn_principal_t *as, cn_dispatch_result_t *result,
c_log_debug("got args: %p", args);
assert((send_arg->has_cap || send_arg->has_msg) &&
"cptr, msg, or both args must be set");
struct cn_rp_elem *e = NULL;
if (send_arg->has_cap) {
if (cn_rp_elem_normal(as, send_arg->cap,
send_arg->has_msg ? &send_arg->msg : NULL,
&e) != 0) {
res = fail_invoke(result, "couldn't allocate rp element");
if (cn_rp_send(obj_cnode, send_arg->cap,
send_arg->has_msg ? &send_arg->msg : NULL) != 0) {
res = fail_invoke(result, "object of type '%s' does not support method",
cn_objtype_name(obj->type));
goto fail1;
}
} else if (send_arg->has_msg && ! send_arg->has_cap) {
struct cn_rp_elem *e = NULL;
if (cn_rp_elem_message(&send_arg->msg, &e) != 0) {
res = fail_invoke(result, "couldn't allocate rp element");
goto fail1;
}
if (cn_rp_send_rp_elem(obj_cnode, e) != 0) {
cn_rp_elem_free(e);
res = fail_invoke(result, "object of type '%s' does not support method",
cn_objtype_name(obj->type));
goto fail1;
}
} else {
cn_abort("unreachable");
}
if (cn_rp_send_rp_elem(obj_cnode, e) != 0) {
cn_rp_elem_free(e);
res = fail_invoke(result, "object of type '%s' does not support method",
cn_objtype_name(obj->type));
goto fail1;
}
}
break;
}
break;
case CN_RP_RECV: {
cn_objtype_t recvd_type;
cptr_t recvd_cap;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment