Enet fixes (#200)
* Network/ENet: Fix UnreliableFragment flag * Network/ENet: Match libenet new behavior on DisconnectLater
This commit is contained in:
parent
bdb5a4b3bd
commit
853e01c192
|
|
@ -172,6 +172,8 @@ Nazara Engine:
|
|||
- ⚠ **By default, Nazara computes the mass center of all 2D physics object when calling SetGeom**
|
||||
- ⚠ Added Collider2D::ComputeCenterOfMass
|
||||
- Signal now implement a copy constructor and copy assignation operator for convenience
|
||||
- Fixed ENet UnreliableFragment packets sent as Unreliable (and such being incomplete upon reception)
|
||||
- ENet DisconnectLater now reflects libenet behavior (and is waiting for unreliable commands to be sent before disconnecting for good)
|
||||
|
||||
Nazara Development Kit:
|
||||
- Added ImageWidget (#139)
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace Nz
|
|||
|
||||
inline bool ENetPeer::HasPendingCommands()
|
||||
{
|
||||
return m_outgoingReliableCommands.empty() && m_outgoingUnreliableCommands.empty() && m_sentReliableCommands.empty();
|
||||
return m_outgoingReliableCommands.empty() && m_outgoingUnreliableCommands.empty() && m_sentReliableCommands.empty() && m_sentUnreliableCommands.empty();
|
||||
}
|
||||
|
||||
inline bool ENetPeer::IsConnected() const
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ namespace Nz
|
|||
if ((packetRef->flags & (ENetPacketFlag_Reliable | ENetPacketFlag_UnreliableFragment)) == ENetPacketFlag_UnreliableFragment &&
|
||||
channel.outgoingUnreliableSequenceNumber < 0xFFFF)
|
||||
{
|
||||
commandNumber = ENetProtocolCommand_SendUnreliable;
|
||||
commandNumber = ENetProtocolCommand_SendUnreliableFragment;
|
||||
startSequenceNumber = HostToNet<UInt16>(channel.outgoingUnreliableSequenceNumber + 1);
|
||||
}
|
||||
else
|
||||
|
|
@ -770,7 +770,7 @@ namespace Nz
|
|||
break;
|
||||
|
||||
if ((incomingCommand.command.header.command & ENetProtocolCommand_Mask) != ENetProtocolCommand_SendUnreliableFragment ||
|
||||
totalLength != incomingCommand.packet->data.GetDataSize() || fragmentCount != incomingCommand.fragments.GetSize())
|
||||
totalLength != incomingCommand.packet->data.GetDataSize() || fragmentCount != incomingCommand.fragments.GetSize())
|
||||
return false;
|
||||
|
||||
startCommand = &incomingCommand;
|
||||
|
|
@ -778,9 +778,10 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
if (startCommand)
|
||||
if (!startCommand)
|
||||
{
|
||||
if (!QueueIncomingCommand(*command, nullptr, totalLength, ENetPacketFlag_UnreliableFragment, fragmentCount))
|
||||
startCommand = QueueIncomingCommand(*command, nullptr, totalLength, ENetPacketFlag_UnreliableFragment, fragmentCount);
|
||||
if (!startCommand)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1040,7 +1041,13 @@ namespace Nz
|
|||
|
||||
void ENetPeer::RemoveSentUnreliableCommands()
|
||||
{
|
||||
if (m_sentUnreliableCommands.empty())
|
||||
return;
|
||||
|
||||
m_sentUnreliableCommands.clear();
|
||||
|
||||
if (m_state == ENetPeerState::DisconnectLater && !HasPendingCommands())
|
||||
Disconnect(m_eventData);
|
||||
}
|
||||
|
||||
void ENetPeer::ResetQueues()
|
||||
|
|
|
|||
Loading…
Reference in New Issue