本文整理汇总了C++中EventMessage::GetProtocolMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ EventMessage::GetProtocolMessage方法的具体用法?C++ EventMessage::GetProtocolMessage怎么用?C++ EventMessage::GetProtocolMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventMessage
的用法示例。
在下文中一共展示了EventMessage::GetProtocolMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleIOMessageEvent
void IOHandler::HandleIOMessageEvent(const EventMessage& message) {
MI_LOG_TRACE(logger, "HandleIOMessageEvent");
IODescriptor* descriptor =
IODescriptorFactory::GetIODescriptor(message.descriptor_id);
if (!descriptor) {
MI_LOG_DEBUG(logger, "HandleIOCloseEvent descriptor not found:"
<< message.descriptor_id);
HandleIOMessageFailure(message);
return;
}
Channel* channel = dynamic_cast<Channel*>(descriptor);
if (!channel) {
MI_LOG_ERROR(logger, "IOHandler::HandleIOMessageEvent descriptor is not channel");
HandleIOMessageFailure(message);
return;
}
ProtocolMessage* protocol_message = message.GetProtocolMessage();
if (0 != channel->EncodeMessage(protocol_message)) {
HandleIOMessageFailure(message);
return;
}
descriptor->OnWrite();
}
示例2: HandleIOMessageFailure
void IOHandler::HandleIOMessageFailure(const EventMessage& message) {
ProtocolMessage* protocol_message = message.GetProtocolMessage();
if (protocol_message->direction == ProtocolMessage::kOutgoingRequest) {
protocol_message->status = ProtocolMessage::kInternalFailure;
if (!GetIOService()->GetServiceStage()->Send(protocol_message)) {
MI_LOG_WARN(logger, "IOHandler::HandleIOMessageFailure send fail");
}
} else {
message.Destroy();
}
}