Skip to content

Commit 7ebb7bc

Browse files
fix: Don't accept invalid connections in UnityTransport.Send
1 parent bb0566c commit 7ebb7bc

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
2222

2323
### Fixed
2424

25+
- Fixed an issue in `UnityTransport` where the transport would accept sends on invalid connections, leading to a useless memory allocation and confusing error message.
2526
- Fixed issue where the time delta that interpolators used would not be properly updated during multiple fixed update invocations within the same player loop frame. (#3355)
2627
- Fixed issue when using a distributed authority network topology and many clients attempt to connect simultaneously the session owner could max-out the maximum in-flight reliable messages allowed, start dropping packets, and some of the connecting clients would fail to fully synchronize. (#3350)
2728
- Fixed issue when using a distributed authority network topology and scene management was disabled clients would not be able to spawn any new network prefab instances until synchronization was complete. (#3350)

com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,8 +1347,13 @@ public override NetcodeNetworkEvent PollEvent(out ulong clientId, out ArraySegme
13471347
/// <param name="networkDelivery">The delivery type (QoS) to send data with</param>
13481348
public override void Send(ulong clientId, ArraySegment<byte> payload, NetworkDelivery networkDelivery)
13491349
{
1350-
var pipeline = SelectSendPipeline(networkDelivery);
1350+
var connection = ParseClientId(clientId);
1351+
if (!m_Driver.IsCreated || m_Driver.GetConnectionState(connection) != NetworkConnection.State.Connected)
1352+
{
1353+
return;
1354+
}
13511355

1356+
var pipeline = SelectSendPipeline(networkDelivery);
13521357
if (pipeline != m_ReliableSequencedPipeline && payload.Count > m_MaxPayloadSize)
13531358
{
13541359
Debug.LogError($"Unreliable payload of size {payload.Count} larger than configured 'Max Payload Size' ({m_MaxPayloadSize}).");

0 commit comments

Comments
 (0)