本文整理汇总了C++中OutputMessagePool::addToAutoSend方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputMessagePool::addToAutoSend方法的具体用法?C++ OutputMessagePool::addToAutoSend怎么用?C++ OutputMessagePool::addToAutoSend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputMessagePool
的用法示例。
在下文中一共展示了OutputMessagePool::addToAutoSend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: send
bool Connection::send(OutputMessage_ptr msg)
{
m_connectionLock.lock();
if (m_connectionState != CONNECTION_STATE_OPEN || m_writeError) {
m_connectionLock.unlock();
return false;
}
if (m_pendingWrite == 0) {
msg->getProtocol()->onSendMessage(msg);
internalSend(msg);
} else {
OutputMessagePool* outputPool = OutputMessagePool::getInstance();
outputPool->addToAutoSend(msg);
}
m_connectionLock.unlock();
return true;
}
示例2: send
bool Connection::send(OutputMessage_ptr msg)
{
#ifdef __DEBUG_NET_DETAIL__
std::cout << "Connection::send init" << std::endl;
#endif
m_connectionLock.lock();
if(m_connectionState != CONNECTION_STATE_OPEN || m_writeError){
m_connectionLock.unlock();
return false;
}
if(m_pendingWrite == 0){
msg->getProtocol()->onSendMessage(msg);
TRACK_MESSAGE(msg);
#ifdef __DEBUG_NET_DETAIL__
std::cout << "Connection::send " << msg->getMessageLength() << std::endl;
#endif
internalSend(msg);
}
else{
#ifdef __DEBUG_NET__
std::cout << "Connection::send Adding to queue " << msg->getMessageLength() << std::endl;
#endif
TRACK_MESSAGE(msg);
OutputMessagePool* outputPool = OutputMessagePool::getInstance();
outputPool->addToAutoSend(msg);
}
m_connectionLock.unlock();
return true;
}