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


C++ OutputMessage_ptr::reset方法代码示例

本文整理汇总了C++中OutputMessage_ptr::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputMessage_ptr::reset方法的具体用法?C++ OutputMessage_ptr::reset怎么用?C++ OutputMessage_ptr::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OutputMessage_ptr的用法示例。


在下文中一共展示了OutputMessage_ptr::reset方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getOutputMessage

OutputMessage_ptr OutputMessagePool::getOutputMessage(Protocol* protocol, bool autosend /*= true*/)
{
	#ifdef __DEBUG_NET_DETAIL__
	std::cout << "request output message - auto = " << autosend << std::endl;
	#endif
	if(m_shutdown)
		return OutputMessage_ptr();

	OTSYS_THREAD_LOCK_CLASS lockClass(m_outputPoolLock);
	if(!protocol->getConnection())
		return OutputMessage_ptr();

	if(m_outputMessages.empty())
	{
		OutputMessage* msg = new OutputMessage();
		m_outputMessages.push_back(msg);
#ifdef __TRACK_NETWORK__
		m_allOutputMessages.push_back(msg);
#endif
	}

	OutputMessage_ptr omsg;
	omsg.reset(m_outputMessages.back(),
		boost::bind(&OutputMessagePool::releaseMessage, this, _1));

	m_outputMessages.pop_back();
	configureOutputMessage(omsg, protocol, autosend);
	return omsg;
}
开发者ID:Fir3element,项目名称:035,代码行数:29,代码来源:outputmessage.cpp

示例2: getOutputMessage

OutputMessage_ptr OutputMessagePool::getOutputMessage(Protocol* protocol, bool autosend /*= true*/)
{
	if (!m_isOpen) {
		return OutputMessage_ptr();
	}

	std::lock_guard<std::recursive_mutex> lockClass(m_outputPoolLock);

	if (!protocol->getConnection()) {
		return OutputMessage_ptr();
	}

	if (m_outputMessages.empty()) {
		OutputMessage* msg = new OutputMessage();
		m_outputMessages.push_back(msg);
	}

	OutputMessage_ptr outputmessage;
	outputmessage.reset(m_outputMessages.back(),
	                    std::bind(&OutputMessagePool::releaseMessage, this, std::placeholders::_1));

	m_outputMessages.pop_back();

	configureOutputMessage(outputmessage, protocol, autosend);
	return outputmessage;
}
开发者ID:A-Dirty-Rag,项目名称:forgottenserver,代码行数:26,代码来源:outputmessage.cpp

示例3: onWriteOperation

void Connection::onWriteOperation(OutputMessage_ptr msg, const boost::system::error_code& error)
{
	#ifdef __DEBUG_NET_DETAIL__
	std::cout << "onWriteOperation" << std::endl;
	#endif

	m_connectionLock.lock();
	m_writeTimer.cancel();

	TRACK_MESSAGE(msg);
	msg.reset();

	if(error){
		handleWriteError(error);
	}

	if(m_connectionState != CONNECTION_STATE_OPEN || m_writeError){
		closeSocket();
		closeConnection();
		m_connectionLock.unlock();
		return;
	}

	--m_pendingWrite;
	m_connectionLock.unlock();
}
开发者ID:angeliker,项目名称:OTHire,代码行数:26,代码来源:connection.cpp

示例4: getOutputMessage

OutputMessage_ptr OutputMessagePool::getOutputMessage(Protocol* protocol, bool autosend /*= true*/)
{
	#ifdef __DEBUG_NET_DETAIL__
	std::cout << "request output message - auto = " << autosend << std::endl;
	#endif

	if(!m_isOpen){
		return OutputMessage_ptr();
	}

	boost::recursive_mutex::scoped_lock lockClass(m_outputPoolLock);

	if(protocol->getConnection() == NULL){
		return OutputMessage_ptr();
	}

	if(m_outputMessages.empty()){
		OutputMessage* msg = new OutputMessage();
		m_outputMessages.push_back(msg);

#ifdef __TRACK_NETWORK__
		m_allOutputMessages.push_back(msg);
#endif
	}

	OutputMessage_ptr outputmessage;
	outputmessage.reset(m_outputMessages.back(),
		boost::bind(&OutputMessagePool::releaseMessage, this, _1));

	m_outputMessages.pop_back();

	configureOutputMessage(outputmessage, protocol, autosend);
	return outputmessage;
}
开发者ID:ChubNtuck,项目名称:avesta74,代码行数:34,代码来源:outputmessage.cpp

示例5: onWriteOperation

void Connection::onWriteOperation(OutputMessage_ptr msg, const boost::system::error_code& error)
{
  #ifdef __DEBUG_NET_DETAIL__
	std::clog << "onWriteOperation" << std::endl;
  #endif

	msg.reset();

	m_connectionLock.lock();

	if(!error)
	{
		if(m_pendingWrite > 0)
		{
			if(!m_outputQueue.empty())
			{
				OutputMessage_ptr msg = m_outputQueue.front();
				m_outputQueue.pop_front();
				internalSend(msg);
			  #ifdef __DEBUG_NET_DETAIL__
				std::clog << "Connection::onWriteOperation send " << msg->getMessageLength() << std::endl;
			  #endif
			}
			
			m_pendingWrite--;
		}
		else
		{
			std::clog << "Error: [Connection::onWriteOperation] Getting unexpected notification!" << std::endl;
			// Error. Pending operations counter is 0, but we are getting a
			// notification!!
		}
	}
	else
	{
        m_pendingWrite--;
		handleWriteError(error);
	}

	if(m_closeState == CLOSE_STATE_CLOSING)
	{
		if(!closingConnection())
			m_connectionLock.lock();
		return;
	}

	m_connectionLock.unlock();
}
开发者ID:tryller,项目名称:otserv,代码行数:48,代码来源:connection.cpp

示例6: onWriteOperation

void Connection::onWriteOperation(OutputMessage_ptr msg, const boost::system::error_code& error)
{
	std::lock_guard<std::recursive_mutex> lockClass(m_connectionLock);;
	m_writeTimer.cancel();

	msg.reset();

	if (error) {
		handleWriteError(error);
	}

	if (m_connectionState != CONNECTION_STATE_OPEN || m_writeError) {
		closeSocket();
		close();
		return;
	}

	--m_pendingWrite;
}
开发者ID:Felipe1993,项目名称:tfs1041_oldschool,代码行数:19,代码来源:connection.cpp

示例7: onWriteOperation

void Connection::onWriteOperation(OutputMessage_ptr msg, const boost::system::error_code& error)
{
	m_connectionLock.lock();
	m_writeTimer.cancel();

	msg.reset();

	if (error) {
		handleWriteError(error);
	}

	if (m_connectionState != CONNECTION_STATE_OPEN || m_writeError) {
		closeSocket();
		closeConnection();
		m_connectionLock.unlock();
		return;
	}

	--m_pendingWrite;
	m_connectionLock.unlock();
}
开发者ID:EnzzoCaaue,项目名称:forgottenserver,代码行数:21,代码来源:connection.cpp

示例8: onWrite

void Connection::onWrite(OutputMessage_ptr msg, const boost::system::error_code& error) {
	LOGt("Connection::onWrite()");

	boost::recursive_mutex::scoped_lock lock(m_connectionLock);

	m_writeTimer.cancel();

	TRACK_MESSAGE(msg);
	msg.reset();
	if(error)
		handleWriteError(error);

	if(m_connectionState != CONNECTION_STATE_OPEN || m_writeError)
	{
		closeSocket();
		close();

		return;
	}

	--m_pendingWrite;
}
开发者ID:novasdream,项目名称:tyano-core,代码行数:22,代码来源:connection.cpp


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