Skip to content

Commit

Permalink
maint: improve overall logic in elimination_handler
Browse files Browse the repository at this point in the history
  • Loading branch information
diamante0018 committed May 30, 2024
1 parent 89f2924 commit 27c2b2b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/services/elimination_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void elimination_handler::run_frame()
(server.state == game_server::state::can_ping && diff > 15min))
{
context.remove();
return;
}

if (server.game == game_type::unknown)
Expand All @@ -43,13 +44,15 @@ void elimination_handler::run_frame()
console::log("Removing T7 server '%s' because they are using an outdated protocol (%i)", context.get_address().to_string().data(), server.protocol);
#endif
context.remove();
return;
}

++server_count[server.game][context.get_address().to_string(false)];
if (server_count[server.game][context.get_address().to_string(false)] > MAX_SERVERS_PER_GAME)
{
console::log("Removing server '%s' because it exceeds MAX_SERVERS_PER_GAME", context.get_address().to_string().data());
context.remove();
return;
}

const auto name = utils::string::to_lower(server.name);
Expand All @@ -59,7 +62,7 @@ void elimination_handler::run_frame()
{
console::log("Removing server '%s' (%s) because it contains a bad name", server.name.data(), context.get_address().to_string().data());
context.remove();
break;
return;
}
}
});
Expand Down

0 comments on commit 27c2b2b

Please sign in to comment.