예제 #1
0
void CBufferPool::PutFreeBuffer(TBuffer* pBuffer)
{
	if(pBuffer->IsValid())
	{
		BOOL bOK = FALSE;

		{
			CCriSecLock locallock(pBuffer->cs);

			if(pBuffer->IsValid())
			{
				pBuffer->Reset();
				bOK = TRUE;
			}
		}

		if(bOK)
		{
			m_itPool.PutFreeItem(pBuffer->items);
			
			{
				CCriSecLock locallock(m_csFreeBuffer);
				m_lsFreeBuffer.PushBack(pBuffer);
			}

			if((DWORD)m_lsFreeBuffer.Size() > m_dwBufferPoolHold)
				CompressFreeBuffer(m_dwBufferPoolSize);
		}
	}
}
예제 #2
0
void CIocpServer::AddFreeBufferObj(TBufferObj* pBufferObj)
{
	CCriSecLock locallock(m_csFreeBuffer);

	m_lsFreeBuffer.push_back(pBufferObj);

	if(m_lsFreeBuffer.size() > m_dwFreeBufferObjHold)
		CompressFreeBuffer(m_dwFreeBufferObjPool);
}
예제 #3
0
void CTcpAgent::AddFreeBufferObj(TBufferObj* pBufferObj)
{
	if(m_lsFreeBuffer.size() < m_dwFreeBufferObjHold)
	{
		CCriSecLock locallock(m_csFreeBuffer);
		m_lsFreeBuffer.push_back(pBufferObj);
	}
	else
	{
		DeleteBufferObj(pBufferObj);
		CompressFreeBuffer(m_dwFreeBufferObjPool);
	}
}
예제 #4
0
void CUdpServer::AddFreeBufferObj(TUdpBufferObj* pBufferObj)
{
	// ~ 灵异事件 ~
	// 32 位 Release 版本:当客户端连上服务器时会导致服务器崩溃

	/*
	if(m_lsFreeBuffer.size() < m_dwFreeBufferObjHold)
	{
		CCriSecLock locallock(m_csFreeBuffer);
		m_lsFreeBuffer.push_back(pBufferObj);
	}
	else
	{
		DeleteBufferObj(pBufferObj);
		CompressFreeBuffer(m_dwFreeBufferObjPool);
	}
	*/

#if defined(_DEBUG) || defined(_WIN64)
	if(m_lsFreeBuffer.size() < m_dwFreeBufferObjHold)
	{
		CCriSecLock locallock(m_csFreeBuffer);
		m_lsFreeBuffer.push_back(pBufferObj);
	}
	else
	{
		DeleteBufferObj(pBufferObj);
		CompressFreeBuffer(m_dwFreeBufferObjPool);
	}
#else
	{
		CCriSecLock locallock(m_csFreeBuffer);
		m_lsFreeBuffer.push_back(pBufferObj);
	}

	if(m_lsFreeBuffer.size() > m_dwFreeBufferObjHold)
		CompressFreeBuffer(m_dwFreeBufferObjPool);
#endif
}
예제 #5
0
void CTcpAgent::ReleaseFreeBuffer()
{
	CompressFreeBuffer(0);
}
예제 #6
0
void CTcpServer::ReleaseFreeBuffer()
{
	CompressFreeBuffer(0);
}