如何设置 Cap'n Proto RPC 消息遍历限制? [英] How to set the Cap'n Proto RPC message traversal limit?

查看:68
本文介绍了如何设置 Cap'n Proto RPC 消息遍历限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用超过默认消息遍历限制的 Rust Cap'n Proto API 发送 RPC.当我尝试发送消息时,出现以下错误:

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.

如果我正在使用 capnp::serialize::read_message,我可以提供一个 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?

推荐答案

您可以在构建 VatNetwork:

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

这篇关于如何设置 Cap'n Proto RPC 消息遍历限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆