// Disconnect all clients and shut down the server void DisconnectClientsAndShutdown() { Debug.Log("Server detected remote shutdown signal. Disconnecting all clients and shutting down server."); var disconnectJob = new DisconnectAllClientsJob { driver = m_ServerDriver, connections = m_Connections }; // Finish up all other active jobs m_UpdateHandle.Complete(); // Schedule a new disconnect job m_UpdateHandle = disconnectJob.Schedule(); // Update the driver after the disconnect m_UpdateHandle = m_ServerDriver.ScheduleUpdate(m_UpdateHandle); // Wait for everything to finish m_UpdateHandle.Complete(); // Terminate the server ShutdownServer(0); }
// Disconnect all clients and shut down the server void DisconnectClients() { if (InTerminalState) { return; } m_ShuttingDown = true; //Debug.Log("Server detected remote shutdown signal. Disconnecting all clients and shutting down server."); Debug.Log("Disconnecting all clients and shutting down UDP ping server."); var disconnectJob = new DisconnectAllClientsJob { driver = m_ServerDriver, connections = m_Connections }; // Finish up all other active jobs m_UpdateHandle.Complete(); // Schedule a new disconnect job m_UpdateHandle = disconnectJob.Schedule(); // Update the driver after the disconnect m_UpdateHandle = m_ServerDriver.ScheduleUpdate(m_UpdateHandle); // Wait for everything to finish m_UpdateHandle.Complete(); }