bool SFProtobufProtocol::SendRequest(BasePacket* pPacket) { unsigned int uWrittenBytes = 0; int iResult = serializeOutgoingPacket(*pPacket, oBuffer, uWrittenBytes); if (iResult!= SFProtocol::Success) { return false; } unsigned int uSize = oBuffer.GetDataSize(); SFEngine::GetInstance()->SendInternal(pPacket->GetSerial(), oBuffer.GetBuffer(), uSize); oBuffer.Pop(uSize); return true; }
BOOL SFProtobufProtocol::SendRequest(ISession* pSession, BasePacket* pPacket) { unsigned int uWrittenBytes = 0; int iResult = serializeOutgoingPacket(*pPacket, oBuffer, uWrittenBytes); if (iResult!= SFProtocol::Success) { return false; } unsigned int uSize = oBuffer.GetDataSize(); pSession->SendInternal(oBuffer.GetBuffer(), uSize); oBuffer.Pop(uSize); return true; }
bool SFProtobufProtocol::Encode(BasePacket* pPacket, char** ppBuffer, int& bufferSize) { unsigned int uWrittenBytes = 0; int iResult = serializeOutgoingPacket(*pPacket, oBuffer, uWrittenBytes); if (iResult != SFProtocol::Success) { return false; } unsigned int uSize = oBuffer.GetDataSize(); oBuffer.Pop(uSize); *ppBuffer = oBuffer.GetBuffer(); bufferSize = uSize; return true; }