NodeCall
NodeCall: caller-side Node.call and server-side RPC dispatch loop (P3 L4).
The glue between the transport (NetKernel) and the RPC core (NodeRpc): the caller sends a CallRequest frame and waits for the matching CallReply; the server-side dispatch loop reads request frames and sends reply frames. Uses dedicated RPC connections (not shared with SWIM gossip connections).
call is synchronous: it blocks the calling task until the reply arrives or the connection closes. March's green-thread scheduler yields on socket I/O, so a blocked call lets the server task run and vice versa.
Type annotations use bare names (Targets, RemoteRef, Pid, CallError) rather than qualified paths (NodeRpc.Targets, etc.) to avoid qualified-vs-bare unification failures at call sites.
Functions
Send one RPC request for [fref] with MessagePack-encoded [args] on [fd] and block until the reply carrying [correlation] arrives. Frames that are not that reply are skipped. [now_ms] is compared against [deadline_ms] once, up front (pass the current unix time in ms): when now_ms >= deadline_ms it returns Err(DeadlineExceeded) without sending. After the request is sent the deadline is only carried to the peer, not enforced here: the call waits until a matching reply or a socket error.
Returns Ok(payload) (the MessagePack-encoded return value), or Err: DeadlineExceeded; Forbidden when certificate mode refuses raw frames on [fd] (counted, nothing sent); NoConnection when the send or a read fails; or the error the peer replied with (NoTarget, TypeMismatch, VersionSkew, RemoteExit(reason), Forbidden).
let fref = RemoteCall.remote_ref("Math", "add", sig_hash, impl_hash)
match NodeCall.call(fd, fref, Msgpack.encode(args), me, deadline, 1, now) do
Ok(bytes) -> Msgpack.decode(bytes)
Err(e) -> Err(RemoteCall.error_message(e))
endRead one RPC request frame from [fd], dispatch it against [targets] (NodeRpc.handle_frame, which falls back to the compiler-registered remote stubs), and send the reply frame back. A frame that does not decode as a request is dropped with no reply (there is no correlation to echo back), and is still Ok. On a connection that refuses raw frames (certificate mode without raw_send) the request is not dispatched: it is counted and answered Forbidden. Returns Err with the message on a read or write failure.