mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 13:00:32 +00:00
Change SendPacket with only type to not have a payload, add recv version
This commit is contained in:
@@ -25,6 +25,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
inline uint32_t RecvPacket(Network::Socket *sock)
|
||||
{
|
||||
if(sock == NULL)
|
||||
return ~0U;
|
||||
|
||||
uint32_t t = 0;
|
||||
if(!sock->RecvDataBlocking(&t, sizeof(t)))
|
||||
return ~0U;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
template <typename PacketTypeEnum>
|
||||
bool RecvPacket(Network::Socket *sock, PacketTypeEnum &type, vector<byte> &payload)
|
||||
{
|
||||
@@ -77,15 +89,10 @@ bool SendPacket(Network::Socket *sock, PacketTypeEnum type)
|
||||
if(sock == NULL)
|
||||
return false;
|
||||
|
||||
uint32_t payloadLength = 0;
|
||||
|
||||
uint32_t t = (uint32_t)type;
|
||||
if(!sock->SendDataBlocking(&t, sizeof(t)))
|
||||
return false;
|
||||
|
||||
if(!sock->SendDataBlocking(&payloadLength, sizeof(payloadLength)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user