本文整理汇总了C++中DatagramPtr::add_string方法的典型用法代码示例。如果您正苦于以下问题:C++ DatagramPtr::add_string方法的具体用法?C++ DatagramPtr::add_string怎么用?C++ DatagramPtr::add_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatagramPtr
的用法示例。
在下文中一共展示了DatagramPtr::add_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_datagram
//.........这里部分代码省略.........
m_fields_sendable[do_id] = fields;
}
break;
case CLIENTAGENT_ADD_SESSION_OBJECT: {
doid_t do_id = dgi.read_doid();
if(m_session_objects.find(do_id) != m_session_objects.end()) {
m_log->warning() << "Received add session object for existing session object "
<< do_id << ".\n";
return;
}
m_log->debug() << "Added session object with id " << do_id << ".\n";
m_session_objects.insert(do_id);
}
break;
case CLIENTAGENT_REMOVE_SESSION_OBJECT: {
doid_t do_id = dgi.read_doid();
if(m_session_objects.find(do_id) == m_session_objects.end()) {
m_log->warning() << "Received remove session object for non-session object "
<< do_id << ".\n";
return;
}
m_log->debug() << "Removed session object with id " << do_id << ".\n";
m_session_objects.erase(do_id);
}
break;
case CLIENTAGENT_GET_NETWORK_ADDRESS: {
DatagramPtr resp = Datagram::create(sender, m_channel, CLIENTAGENT_GET_NETWORK_ADDRESS_RESP);
resp->add_uint32(dgi.read_uint32()); // Context
resp->add_string(get_remote_address());
resp->add_uint16(get_remote_port());
resp->add_string(get_local_address());
resp->add_uint16(get_local_port());
route_datagram(resp);
}
break;
case STATESERVER_OBJECT_SET_FIELD: {
doid_t do_id = dgi.read_doid();
if(!lookup_object(do_id)) {
if(try_queue_pending(do_id, in_dg)) {
return;
}
m_log->warning() << "Received server-side field update for unknown object "
<< do_id << ".\n";
return;
}
if(sender != m_channel) {
uint16_t field_id = dgi.read_uint16();
handle_set_field(do_id, field_id, dgi);
}
}
break;
case STATESERVER_OBJECT_SET_FIELDS: {
doid_t do_id = dgi.read_doid();
if(!lookup_object(do_id)) {
if(try_queue_pending(do_id, in_dg)) {
return;
}
m_log->warning() << "Received server-side multi-field update for unknown object "
<< do_id << ".\n";
return;
}