Exemple #1
0
EnFetchResult CTcpPullAgent::Fetch(CONNID dwConnID, BYTE* pData, int iLength)
{
	ASSERT(pData != nullptr && iLength > 0);

	EnFetchResult result	= FR_DATA_NOT_FOUND;
	TBuffer* pBuffer		= m_bfPool[dwConnID];

	if(pBuffer != nullptr && pBuffer->IsValid())
	{
		CCriSecLock locallock(pBuffer->CriSec());

		if(pBuffer->IsValid())
		{
			if(pBuffer->Length() >= iLength)
			{
				pBuffer->Fetch(pData, iLength);
				result = FR_OK;
			}
			else
				result = FR_LENGTH_TOO_LONG;
		}
	}

	return result;
}
Exemple #2
0
EnHandleResult CTcpPullServer::FireReceive(TSocketObj* pSocketObj, const BYTE* pData, int iLength)
{
	TBuffer* pBuffer = m_bfPool[pSocketObj->connID];
	ASSERT(pBuffer && pBuffer->IsValid());

	pBuffer->Cat(pData, iLength);

	return __super::FireReceive(pSocketObj, pBuffer->Length());
}
EnHandleResult CTcpPullAgent::FireReceive(TSocketObj* pSocketObj, const BYTE* pData, int iLength)
{
	TBuffer* pBuffer = nullptr;
	GetConnectionReserved(pSocketObj, (PVOID*)&pBuffer);
	ASSERT(pBuffer && pBuffer->IsValid());

	pBuffer->Cat(pData, iLength);

	return __super::FireReceive(pSocketObj, pBuffer->Length());
}
Exemple #4
0
EnHandleResult CTcpPullAgent::FireReceive(TSocketObj* pSocketObj, const BYTE* pData, int iLength)
{
	TBuffer* pBuffer = m_bfPool[pSocketObj->connID];

	if(pBuffer != nullptr && pBuffer->IsValid())
	{
		int len = 0;

		{
			CCriSecLock locallock(pBuffer->CriSec());

			if(pBuffer->IsValid())
			{
				pBuffer->Cat(pData, iLength);
				len = pBuffer->Length();
			}
		}

		if(len > 0) return __super::FireReceive(pSocketObj, len);
	}

	return HR_IGNORE;
}
ISocketListener::EnHandleResult CTcpPullServer::FireReceive(CONNID dwConnID, const BYTE* pData, int iLength)
{
	TBuffer* pBuffer = m_bfPool[dwConnID];

	if(pBuffer != nullptr && pBuffer->IsValid())
	{
		int len = 0;

		{
			CCriSecLock locallock(pBuffer->CriSec());

			if(pBuffer->IsValid())
			{
				pBuffer->Cat(pData, iLength);
				len = pBuffer->Length();
			}
		}

		if(len > 0) return __super::FireReceive(dwConnID, len);
	}

	return ISocketListener::HR_IGNORE;
}