pdiffley
pdiffley

Reputation: 713

How to set the Cap'n Proto RPC message traversal limit?

I need to send an RPC with the Rust Cap'n Proto API that exceeds the default message traversal limit. When I try to send the message, I get the following error:

remote exception: <class \'capnp.lib.capnp.KjException
\'>:capnp/arena.c++:130: failed: Exceeded message traversal limit.
See capnp::ReaderOptions.

If I were reading a message using capnp::serialize::read_message, I could provide a ReaderOptions struct specifying a new traversal limit.

However, I am making and sending a request like in the calculator example instead of reading a message directly. How can I set the traversal limit for my request message?

Upvotes: 1

Views: 825

Answers (1)

David Renshaw
David Renshaw

Reputation: 156

You can set it when you construct the VatNetwork:

pub fn new<U>(
    input_stream: T,
    output_stream: U,
    side: Side,
    receive_options: ReaderOptions,
) -> VatNetwork<T>
where
    U: Write + 'static,

https://github.com/capnproto/capnproto-rust/issues/124#issuecomment-468877758

Upvotes: 1

Related Questions