本文整理汇总了C++中message_ptr::get_content_size方法的典型用法代码示例。如果您正苦于以下问题:C++ message_ptr::get_content_size方法的具体用法?C++ message_ptr::get_content_size怎么用?C++ message_ptr::get_content_size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message_ptr
的用法示例。
在下文中一共展示了message_ptr::get_content_size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
bool ConnectService::process(message_ptr const & message, connection_ptr const & connection)
{
static Engine& engine = Engine::get_instance();
if (message->type != MessageType::PING) return false;
uint32_t id;
_dec_declare2_(req, message->get_content_data(), message->get_content_size());
_dec_get_var32_(req, id);
if (!_dec_valid_(req))
{
DLOG(ERROR) << "Bad Ping format";
return true;
}
NodeConf* config = (NodeConf*) engine.get_component(COMP_SERVERCONF).get();
servernode_map::iterator it = config->nodes.find(id);
if (it != config->nodes.end())
{
servernode_ptr node = it->second;
connection->asyn = true;
connection->authenticated = true;
connection->data = node.get();
connection->type = CT_S2S;
node->connection = connection;
node->state = READY;
_enc_declare_(rep, 64);
_enc_put_msg_header_(rep, MessageType::REPLY, message->id, 0);
_enc_put_var32_(rep, ErrorCode::OK);
_enc_update_msg_size_(rep);
connection->send(_enc_data_(rep), _enc_size_(rep));
}
else
{
_enc_declare_(rep, 64);
_enc_put_msg_header_(rep, MessageType::REPLY, message->id, 0);
_enc_put_var32_(rep, ErrorCode::IS_NOT_FOUND);
_enc_update_msg_size_(rep);
connection->send(_enc_data_(rep), _enc_size_(rep));
}
return true;
}