本文整理汇总了C++中Packet::GetPacketBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ Packet::GetPacketBuffer方法的具体用法?C++ Packet::GetPacketBuffer怎么用?C++ Packet::GetPacketBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet::GetPacketBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompleteSend
int Connections::CompleteSend(DWORD TransferedBytes)
{
UNREFERENCED_PARAMETER(TransferedBytes);
FUNCTION_BEGIN();
IncreaseBytesSend(TransferedBytes);
_mutexSend.Lock();
_sendBuffer.IncreasePopPos(TransferedBytes);
int rc = 0;
if (IsSetControlFlag(CONTROL_FLAG_USE_SEND_QUEUE))
{
Packet * SendPacket = _sendQueue.PeekPacket();
while (SendPacket)
{
if (_sendBuffer.GetPushAvailableSize() <= SendPacket->GetUsedSize())
{
break;
}
BYTE Sequence = (BYTE)(_PacketSendCount & PACKET_MAX_SEQUENCE);
SetSequence(SendPacket->GetPacketHeader(), Sequence);
if (_PacketEncoder)
{
rc = _PacketEncoder->TxEncrypt(*SendPacket);
if (0 != rc)
{
_mutexSend.Unlock();
Logger::Log("Session[%X] TxEncrypt Error[%d]\n", this, rc);
return 1; //ERR_NET_PACKET_ENCRYPT_FAIL
}
}
memcpy(_sendBuffer.GetQueuePushPtr(), SendPacket->GetPacketBuffer(), SendPacket->GetUsedSize());
_sendBuffer.IncreasePushPos(SendPacket->GetUsedSize());
IncreasePacketSend();
_sendQueue.PopPacket();
SAFE_DELETE(SendPacket);
SendPacket = _sendQueue.PeekPacket();
}
}
if (_sendBuffer.GetCurSize())
{
rc = PostSend();
if (0 != rc)
{
_IsSending = false;
_mutexSend.Unlock();
Disconnect(false);
Logger::Log("Session[%X] PostSend Error[%d]\n", this, rc);
return 0;
}
}
else
{
_IsSending = false;
}
_mutexSend.Unlock();
return 0;
}