Add the remaining unreliable fragment flags

This commit is contained in:
Benau 2018-07-27 22:40:28 +08:00
parent 5d3304b1c0
commit b0f20ca5a5
2 changed files with 6 additions and 3 deletions

View File

@ -77,7 +77,9 @@ ENetPacket* Crypto::encryptSend(BareNetworkString& ns, bool reliable)
{
// 4 bytes counter and 4 bytes tag
ENetPacket* p = enet_packet_create(NULL, ns.m_buffer.size() + 8,
(reliable ? ENET_PACKET_FLAG_RELIABLE : ENET_PACKET_FLAG_UNSEQUENCED));
(reliable ? ENET_PACKET_FLAG_RELIABLE :
(ENET_PACKET_FLAG_UNSEQUENCED | ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT))
);
if (p == NULL)
return NULL;

View File

@ -181,8 +181,9 @@ int Network::receiveRawPacket(char *buffer, int buf_len,
void Network::broadcastPacket(NetworkString *data, bool reliable)
{
ENetPacket* packet = enet_packet_create(data->getData(), data->size() + 1,
reliable ? ENET_PACKET_FLAG_RELIABLE
: ENET_PACKET_FLAG_UNSEQUENCED);
(reliable ? ENET_PACKET_FLAG_RELIABLE :
(ENET_PACKET_FLAG_UNSEQUENCED | ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT))
);
enet_host_broadcast(m_host, 0, packet);
} // broadcastPacket