Skip to content

Commit 7473f9d

Browse files
committed
improved error
1 parent ef8a03b commit 7473f9d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Basis/Packages/dev.hai-vr.basis.comms/Scripts/Systems/Runtime/Components/Networking/HVRVariableNetworking.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,10 @@ internal class HVRVariableBehaviour_Remote : IHVRVariableBehaviour
535535
private readonly Dictionary<ushort, int> _networkIdToAddressId = new();
536536
private readonly List<HVRVariableHighFrequency> _upgradedToHighFrequencyInOrder = new();
537537

538+
// Unknown high-frequency network IDs already reported, so a protocol-mismatched remote
539+
// is logged once per ID instead of every packet (which would spam the log at the send rate).
540+
private readonly HashSet<ushort> _reportedUnknownHighFrequencyNetworkIds = new();
541+
538542
private readonly HVRInterpolator _lowFrequencyInterpolator = new(true);
539543
private readonly HVRInterpolator _highFrequencyInterpolator = new(true);
540544

@@ -788,7 +792,7 @@ public void OnPacketReceived(byte localIdentifier, ArraySegment<byte> data)
788792
{
789793
highFrequencyInterpolatorDict[addressId] = DecodeFloat(packet.values[index], highFrequency);
790794
}
791-
else
795+
else if (_reportedUnknownHighFrequencyNetworkIds.Add(highFrequency.networkId))
792796
{
793797
HVRLogging.ProtocolError($"Network ID {highFrequency.networkId} is not known. High frequency value will be ignored.");
794798
}

0 commit comments

Comments
 (0)