mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-26 17:31:45 +02:00
Only perform the leave/enter loop when gamemode is already active/has clients
This commit is contained in:
@ -642,25 +642,29 @@ static void game_mode_reload_config_internal(GameModeContext *self)
|
|||||||
{
|
{
|
||||||
LOG_MSG("Reloading config...\n");
|
LOG_MSG("Reloading config...\n");
|
||||||
|
|
||||||
/* Remove current client optimisations */
|
/* Make sure we have a readwrite lock on ourselves */
|
||||||
pthread_rwlock_rdlock(&self->rwlock);
|
pthread_rwlock_wrlock(&self->rwlock);
|
||||||
for (GameModeClient *cl = self->client; cl; cl = cl->next)
|
|
||||||
game_mode_remove_client_optimisations(self, cl->pid);
|
|
||||||
pthread_rwlock_unlock(&self->rwlock);
|
|
||||||
|
|
||||||
/* Shut down the global context */
|
/* Remove current optimisations when we're already active */
|
||||||
game_mode_context_leave(self);
|
if (game_mode_context_num_clients(self)) {
|
||||||
|
for (GameModeClient *cl = self->client; cl; cl = cl->next)
|
||||||
|
game_mode_remove_client_optimisations(self, cl->pid);
|
||||||
|
|
||||||
|
game_mode_context_leave(self);
|
||||||
|
}
|
||||||
|
|
||||||
/* Reload the config */
|
/* Reload the config */
|
||||||
config_reload(self->config);
|
config_reload(self->config);
|
||||||
|
|
||||||
/* Start the global context back up */
|
|
||||||
game_mode_context_enter(self);
|
|
||||||
|
|
||||||
/* Re-apply all current optimisations */
|
/* Re-apply all current optimisations */
|
||||||
pthread_rwlock_rdlock(&self->rwlock);
|
if (game_mode_context_num_clients(self)) {
|
||||||
for (GameModeClient *cl = self->client; cl; cl = cl->next)
|
/* Start the global context back up */
|
||||||
game_mode_apply_client_optimisations(self, cl->pid);
|
game_mode_context_enter(self);
|
||||||
|
|
||||||
|
for (GameModeClient *cl = self->client; cl; cl = cl->next)
|
||||||
|
game_mode_apply_client_optimisations(self, cl->pid);
|
||||||
|
}
|
||||||
|
|
||||||
pthread_rwlock_unlock(&self->rwlock);
|
pthread_rwlock_unlock(&self->rwlock);
|
||||||
|
|
||||||
LOG_MSG("Config reload complete\n");
|
LOG_MSG("Config reload complete\n");
|
||||||
|
Reference in New Issue
Block a user