当前位置: 首页>>代码示例>>C++>>正文


C++ OutputMessagePool::addToAutoSend方法代码示例

本文整理汇总了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;
}
开发者ID:nclx,项目名称:forgottenserver,代码行数:20,代码来源:connection.cpp

示例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;
}
开发者ID:angeliker,项目名称:OTHire,代码行数:36,代码来源:connection.cpp


注:本文中的OutputMessagePool::addToAutoSend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。