本文整理汇总了C++中OutputMessage_ptr::getState方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputMessage_ptr::getState方法的具体用法?C++ OutputMessage_ptr::getState怎么用?C++ OutputMessage_ptr::getState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputMessage_ptr
的用法示例。
在下文中一共展示了OutputMessage_ptr::getState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: send
void OutputMessagePool::send(OutputMessage_ptr msg)
{
OTSYS_THREAD_LOCK(m_outputPoolLock, "");
OutputMessage::OutputMessageState state = msg->getState();
OTSYS_THREAD_UNLOCK(m_outputPoolLock, "");
if(state == OutputMessage::STATE_ALLOCATED_NO_AUTOSEND)
{
#ifdef __DEBUG_NET_DETAIL__
std::cout << "Sending message - SINGLE" << std::endl;
#endif
if(msg->getConnection())
{
if(!msg->getConnection()->send(msg) && msg->getProtocol())
msg->getProtocol()->onSendMessage(msg);
}
#ifdef __DEBUG_NET__
else
std::cout << "Error: [OutputMessagePool::send] NULL connection." << std::endl;
#endif
}
#ifdef __DEBUG_NET__
else
std::cout << "Warning: [OutputMessagePool::send] State != STATE_ALLOCATED_NO_AUTOSEND" << std::endl;
#endif
}
示例2: send
void OutputMessagePool::send(OutputMessage_ptr msg)
{
m_outputPoolLock.lock();
OutputMessage::OutputMessageState state = msg->getState();
m_outputPoolLock.unlock();
if(state == OutputMessage::STATE_ALLOCATED_NO_AUTOSEND)
{
#ifdef __DEBUG_NET_DETAIL__
std::cout << "Sending message - SINGLE" << std::endl;
#endif
if(msg->getConnection())
{
if(!msg->getConnection()->send(msg))
{
// Send only fails when connection is closing (or in error state)
// This call will free the message
msg->getProtocol()->onSendMessage(msg);
}
}
else
{
#ifdef __DEBUG_NET__
std::cout << "Error: [OutputMessagePool::send] NULL connection." << std::endl;
#endif
}
}
else
{
#ifdef __DEBUG_NET__
std::cout << "Warning: [OutputMessagePool::send] State != STATE_ALLOCATED_NO_AUTOSEND" << std::endl;
#endif
}
}
示例3: send
void OutputMessagePool::send(OutputMessage_ptr msg)
{
m_outputPoolLock.lock();
OutputMessage::OutputMessageState state = msg->getState();
m_outputPoolLock.unlock();
if (state == OutputMessage::STATE_ALLOCATED_NO_AUTOSEND) {
Connection_ptr connection = msg->getConnection();
if (connection && !connection->send(msg)) {
// Send only fails when connection is closing (or in error state)
// This call will free the message
msg->getProtocol()->onSendMessage(msg);
}
}
}