Stream exact hot state over negotiated body planes
This commit is contained in:
parent
242c8aaddd
commit
743fa3889e
22 changed files with 320 additions and 14 deletions
|
|
@ -1141,9 +1141,14 @@ namespace GameCult.Networking
|
|||
/// <summary>
|
||||
/// Creates a packet carrying the current acknowledgement state.
|
||||
/// </summary>
|
||||
public CultNetRudpPacket CreateAck()
|
||||
public CultNetRudpPacket CreateAck(uint? acknowledgedSequence = null)
|
||||
{
|
||||
var (ack, ackMask) = AckState();
|
||||
if (acknowledgedSequence.HasValue)
|
||||
{
|
||||
ack = acknowledgedSequence.Value;
|
||||
ackMask = 0;
|
||||
}
|
||||
return new CultNetRudpPacket
|
||||
{
|
||||
PacketType = CultNetRudpPacketType.Ack,
|
||||
|
|
@ -1955,10 +1960,9 @@ namespace GameCult.Networking
|
|||
|
||||
delivered = _deliveredFrames.Count > 0 ? _deliveredFrames.Dequeue() : null;
|
||||
if (packet.PacketType == CultNetRudpPacketType.Accept ||
|
||||
packet.PacketType == CultNetRudpPacketType.Data ||
|
||||
delivered != null)
|
||||
packet.PacketType == CultNetRudpPacketType.Data)
|
||||
{
|
||||
SendPacket(_session.CreateAck());
|
||||
SendPacket(_session.CreateAck(packet.Sequence));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -2108,6 +2112,10 @@ namespace GameCult.Networking
|
|||
/// </summary>
|
||||
public bool Connected => Session.Connected;
|
||||
/// <summary>
|
||||
/// Gets the number of reliable packets still awaiting acknowledgement.
|
||||
/// </summary>
|
||||
public int PendingReliablePacketCount => Session.PendingReliableSequences.Count;
|
||||
/// <summary>
|
||||
/// Gets the last transport-level remote disconnect reason, if one was received.
|
||||
/// </summary>
|
||||
public byte[]? DisconnectReason { get; internal set; }
|
||||
|
|
@ -2349,9 +2357,9 @@ namespace GameCult.Networking
|
|||
}
|
||||
|
||||
delivered = _deliveredFrames.Count > 0 ? _deliveredFrames.Dequeue() : null;
|
||||
if (packet.PacketType == CultNetRudpPacketType.Data || delivered != null)
|
||||
if (packet.PacketType == CultNetRudpPacketType.Data)
|
||||
{
|
||||
SendPacket(existingPeer.RemoteEndPoint, existingPeer.Session.CreateAck());
|
||||
SendPacket(existingPeer.RemoteEndPoint, existingPeer.Session.CreateAck(packet.Sequence));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue