From 1b5a4fe4ee5f252c9b1b4657525b4382f710609b Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Thu, 20 Feb 2020 10:52:56 -0800 Subject: [PATCH] delete non-persistent lobbies when empty --- ServerState.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ServerState.cc b/ServerState.cc index bbe9f56c..ad61b608 100644 --- a/ServerState.cc +++ b/ServerState.cc @@ -76,6 +76,9 @@ void ServerState::change_client_lobby(shared_ptr c, shared_ptr ne if (current_lobby) { send_player_leave_notification(current_lobby, old_lobby_client_id); + if (!(current_lobby->flags & LobbyFlag::Persistent) && (current_lobby->count_clients() == 0)) { + this->remove_lobby(current_lobby->lobby_id); + } } this->send_lobby_join_notifications(new_lobby, c); }