Skip to content

Commit 7fd6ab9

Browse files
fix: end TransportConnect profiler marker on early returns in ConnectEventHandler (#4005)
BeginSample was called at the top of ConnectEventHandler but two early return paths (duplicate server transport ID and duplicate client connect event) exited without calling EndSample, causing the 'Missing Profiler.EndSample' error surfaced by the MultipleConnectMessagesNoop playmode tests.
1 parent c48f54d commit 7fd6ab9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,9 @@ internal void ConnectEventHandler(ulong transportId)
522522
{
523523
NetworkLog.LogError($"[TransportApproval][Server] TransportId {transportId} is already connected to this server!");
524524
}
525+
#if DEVELOPMENT_BUILD || UNITY_EDITOR
526+
s_TransportConnect.End();
527+
#endif
525528
return;
526529
}
527530

@@ -536,6 +539,9 @@ internal void ConnectEventHandler(ulong transportId)
536539
{
537540
NetworkLog.LogError("[TransportApproval][Client] Client received a transport connection event after already connecting!");
538541
}
542+
#if DEVELOPMENT_BUILD || UNITY_EDITOR
543+
s_TransportConnect.End();
544+
#endif
539545
return;
540546
}
541547

0 commit comments

Comments
 (0)