Skip to content

Commit 54dcb4d

Browse files
committed
Remove debug logs and fix xml doc
1 parent 37ee6a7 commit 54dcb4d

File tree

4 files changed

+39
-21
lines changed

4 files changed

+39
-21
lines changed

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ internal void HandleNetworkEvent(NetworkEvent networkEvent, ulong transportClien
444444
switch (networkEvent)
445445
{
446446
case NetworkEvent.Connect:
447-
Debug.Log("Handling connection event");
448447
ConnectEventHandler(transportClientId);
449448
break;
450449
case NetworkEvent.Data:
@@ -493,7 +492,6 @@ internal void ConnectEventHandler(ulong transportClientId)
493492
var hostServer = NetworkManager.IsHost ? "Host" : "Server";
494493
NetworkLog.LogInfo($"[{hostServer}-Side] Transport connection established with pending Client-{clientId}.");
495494
}
496-
Debug.Log("adding pending client");
497495
AddPendingClient(clientId);
498496
}
499497
else
@@ -504,7 +502,6 @@ internal void ConnectEventHandler(ulong transportClientId)
504502
NetworkLog.LogInfo($"[Approval Pending][Client] Transport connection with {serverOrService} established! Awaiting connection approval...");
505503
}
506504

507-
Debug.Log("Sending connection request");
508505
SendConnectionRequest();
509506
StartClientApprovalCoroutine(clientId);
510507
}
@@ -538,14 +535,16 @@ internal void DataEventHandler(ulong transportClientId, ref ArraySegment<byte> p
538535
/// </summary>
539536
internal void DisconnectEventHandler(ulong transportClientId)
540537
{
541-
#if DEVELOPMENT_BUILD || UNITY_EDITOR
542-
s_TransportDisconnect.Begin();
543-
#endif
544538
var (clientId, wasConnectedClient) = TransportIdCleanUp(transportClientId);
545539
if (!wasConnectedClient)
546540
{
547541
return;
548542
}
543+
544+
#if DEVELOPMENT_BUILD || UNITY_EDITOR
545+
s_TransportDisconnect.Begin();
546+
#endif
547+
549548
if (NetworkLog.CurrentLogLevel <= LogLevel.Developer)
550549
{
551550
NetworkLog.LogInfo($"Disconnect Event From {clientId}");
@@ -1085,13 +1084,8 @@ internal NetworkClient AddClient(ulong clientId)
10851084

10861085
if (!ConnectedClientIds.Contains(clientId))
10871086
{
1088-
Debug.Log($"[Client-{NetworkManager.LocalClientId}] Adding newly added client {clientId} to ConnectedClientIds");
10891087
ConnectedClientIds.Add(clientId);
10901088
}
1091-
else
1092-
{
1093-
Debug.Log($"[Client-{NetworkManager.LocalClientId}] Newly added client {clientId} was already in ConnectedClientIds");
1094-
}
10951089

10961090
var distributedAuthority = NetworkManager.DistributedAuthorityMode;
10971091

com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,18 +1468,22 @@ private void HostServerInitialize()
14681468
/// Get the TransportId from the associated ClientId.
14691469
/// </summary>
14701470
/// <param name="clientId">The ClientId to get the TransportId from</param>
1471-
/// <returns>The TransportId associated with the given ClientId</returns>
1471+
/// <returns>
1472+
/// The TransportId associated with the given ClientId if the given clientId is valid; otherwise <see cref="ulong.MaxValue"/>
1473+
/// </returns>
14721474
public ulong GetTransportIdFromClientId(ulong clientId)
14731475
{
1474-
var (id, success) = ConnectionManager.TransportIdToClientId(clientId);
1476+
var (id, success) = ConnectionManager.ClientIdToTransportId(clientId);
14751477
return success ? id : ulong.MaxValue;
14761478
}
14771479

14781480
/// <summary>
14791481
/// Get the ClientId from the associated TransportId.
14801482
/// </summary>
14811483
/// <param name="transportId">The TransportId to get the ClientId from</param>
1482-
/// <returns>The ClientId from the associated TransportId</returns>
1484+
/// <returns>
1485+
/// The ClientId from the associated TransportId if the given transportId is valid; otherwise <see cref="ulong.MaxValue"/>
1486+
/// </returns>
14831487
public ulong GetClientIdFromTransportId(ulong transportId)
14841488
{
14851489
var (id, success) = ConnectionManager.TransportIdToClientId(transportId);

com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/NetcodeIntegrationTest.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,15 @@ protected void SetDistributedAuthorityProperties(NetworkManager networkManager)
484484
/// </summary>
485485
protected virtual bool m_EnableTimeTravel => false;
486486

487+
/// <summary>
488+
/// When true, <see cref="CreateServerAndClients()"/> and <see cref="CreateNewClient"/> will use a <see cref="MockTransport"/>
489+
/// as the <see cref="NetworkConfig.NetworkTransport"/> on the created server and/or clients.
490+
/// When false, a <see cref="UnityTransport"/> is used.
491+
/// </summary>
492+
/// <remarks>
493+
/// This defaults to, and is required to be true when <see cref="m_EnableTimeTravel"/> is true.
494+
/// <see cref="m_EnableTimeTravel"/> will not work with the <see cref="UnityTransport"/> component.
495+
/// </remarks>
487496
protected virtual bool m_UseMockTransport => m_EnableTimeTravel;
488497

489498
/// <summary>
@@ -649,12 +658,12 @@ public IEnumerator SetUp()
649658
{
650659
MockTransport.Reset();
651660
}
661+
}
652662

653-
// Setup the frames per tick for time travel advance to next tick
654-
if (m_EnableTimeTravel)
655-
{
656-
ConfigureFramesPerTick();
657-
}
663+
// Setup the frames per tick for time travel advance to next tick
664+
if (m_EnableTimeTravel)
665+
{
666+
ConfigureFramesPerTick();
658667
}
659668

660669
if (m_SetupIsACoroutine)

com.unity.netcode.gameobjects/Tests/Runtime/TestHelpers/NetcodeIntegrationTestHelpers.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,18 @@ public static bool Create(int clientCount, out NetworkManager server, out Networ
327327
return true;
328328
}
329329

330-
internal static NetworkManager CreateNewClient(int identifier, bool mockTransport = false, bool useCmbService = false)
330+
/// <summary>
331+
/// Creates a new <see cref="NetworkManager"/> and configures it for use in a multi instance setting.
332+
/// </summary>
333+
/// <param name="identifier">The ClientId representation that is used in the name of the NetworkManager</param>
334+
/// <param name="mockTransport">
335+
/// When true, the client is created with a <see cref="MockTransport"/>; otherwise a <see cref="UnityTransport"/> is added
336+
/// </param>
337+
/// <param name="useCmbService">
338+
/// Whether to configure the client to run against a hosted build of the CMB Service. Only applies if mockTransport is set to false.
339+
/// </param>
340+
/// <returns>The newly created <see cref="NetworkManager"/> component.</returns>
341+
public static NetworkManager CreateNewClient(int identifier, bool mockTransport = false, bool useCmbService = false)
331342
{
332343
// Create gameObject
333344
var go = new GameObject("NetworkManager - Client - " + identifier);
@@ -351,7 +362,7 @@ internal static NetworkManager CreateNewClient(int identifier, bool mockTranspor
351362
/// <param name="clients">Output array containing the created NetworkManager instances</param>
352363
/// <param name="useMockTransport">When true, uses mock transport for testing, otherwise uses real transport. Default value is false</param>
353364
/// <param name="useCmbService">If true, each client will be created with transport configured to connect to a locally hosted da service</param>
354-
/// <returns> Returns <see cref="true"/> if the clients were successfully created and configured, otherwise <see cref="false"/>.</returns>
365+
/// <returns> Returns true if the clients were successfully created and configured, otherwise false.</returns>
355366
public static bool CreateNewClients(int clientCount, out NetworkManager[] clients, bool useMockTransport = false, bool useCmbService = false)
356367
{
357368
clients = new NetworkManager[clientCount];

0 commit comments

Comments
 (0)