本文整理汇总了C++中message_ptr::writer方法的典型用法代码示例。如果您正苦于以下问题:C++ message_ptr::writer方法的具体用法?C++ message_ptr::writer怎么用?C++ message_ptr::writer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message_ptr
的用法示例。
在下文中一共展示了message_ptr::writer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: send
void sim_client_session::send(message_ptr& msg)
{
sim_network_provider* rnet = nullptr;
if (!s_switch[task_spec::get(msg->header().local_rpc_code)->rpc_call_channel].get(msg->header().to_address, rnet))
{
dwarn("cannot find destination node %s:%d in simulator",
msg->header().to_address.name.c_str(),
static_cast<int>(msg->header().to_address.port)
);
return;
}
auto server_session = rnet->get_server_session(_net.address());
if (nullptr == server_session)
{
rpc_client_session_ptr cptr = this;
server_session.reset(new sim_server_session(*rnet, _net.address(), cptr));
rnet->on_server_session_accepted(server_session);
}
message_ptr recv_msg(new message(msg->writer().get_buffer()));
recv_msg->header().from_address = msg->header().from_address;
recv_msg->header().to_address = msg->header().to_address;
server_session->on_recv_request(recv_msg,
recv_msg->header().from_address == recv_msg->header().to_address ?
0 : rnet->net_delay_milliseconds()
);
}