This commit is contained in:
vis2k 2021-03-07 13:06:26 +08:00
parent 2797253cc4
commit 382b6c67f4

View File

@ -320,10 +320,7 @@ public static void SendToReady<T>(NetworkIdentity identity, T message, int chann
SendToReady(identity, message, true, channelId);
}
/// <summary>
/// Disconnect all currently connected clients, including the local connection.
/// <para>This can only be called on the server. Clients will receive the Disconnect message.</para>
/// </summary>
/// <summary>Disconnect all connections, including the local connection.</summary>
public static void DisconnectAll()
{
DisconnectAllConnections();
@ -331,10 +328,7 @@ public static void DisconnectAll()
active = false;
}
/// <summary>
/// Disconnect all currently connected clients except the local connection.
/// <para>This can only be called on the server. Clients will receive the Disconnect message.</para>
/// </summary>
/// <summary>Disconnect all currently connected clients except the local connection.</summary>
public static void DisconnectAllConnections()
{
// disconnect and remove all connections.
@ -348,7 +342,7 @@ public static void DisconnectAllConnections()
// until then, let's copy .Values to avoid InvalidOperatinException.
// note that this is only called when stopping the server, so the
// copy is no performance problem.
foreach (NetworkConnection conn in connections.Values.ToList())
foreach (NetworkConnectionToClient conn in connections.Values.ToList())
{
conn.Disconnect();
// call OnDisconnected unless local player in host mode