public override void Close(string msg = null) { if (!started) { return; } if (OwnerConnection != null) { OwnerConnection.Status = NetworkConnectionStatus.Disconnected; } for (int i = pendingClients.Count - 1; i >= 0; i--) { RemovePendingClient(pendingClients[i], DisconnectReason.ServerShutdown, msg); } for (int i = connectedClients.Count - 1; i >= 0; i--) { Disconnect(connectedClients[i], msg ?? DisconnectReason.ServerShutdown.ToString()); } pendingClients.Clear(); connectedClients.Clear(); ChildServerRelay.ShutDown(); OnShutdown?.Invoke(); }
public override void Close(string msg = null) { if (!isActive) { return; } isActive = false; for (int i = remotePeers.Count - 1; i >= 0; i--) { DisconnectPeer(remotePeers[i], msg ?? DisconnectReason.ServerShutdown.ToString()); } Thread.Sleep(100); for (int i = remotePeers.Count - 1; i >= 0; i--) { ClosePeerSession(remotePeers[i]); } ChildServerRelay.ShutDown(); OnDisconnect?.Invoke(); SteamManager.LeaveLobby(); Steamworks.SteamNetworking.ResetActions(); Steamworks.SteamUser.OnValidateAuthTicketResponse -= OnAuthChange; }