moved tries check to top of username loop

This commit is contained in:
Václav Šmejkal 2024-01-27 22:22:36 +01:00
parent 73d0f64fc9
commit d58efbd035
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -389,6 +389,12 @@ void *why2_communicate_thread(void *arg)
if (config_username == NULL || strcmp(config_username, "true") == 0)
{
if (usernames_n++ == WHY2_MAX_USERNAME_TRIES) //ASKED CLIENT WAY TOO FUCKING MANY TIMES FOR USERNAME, KICK HIM
{
exiting = 1;
goto deallocation;
}
if (config_username == NULL) fprintf(stderr, "Your config doesn't contain 'user_pick_username'. Please update your configuration.\n");
while (invalid_username)
@ -416,12 +422,6 @@ void *why2_communicate_thread(void *arg)
{
why2_send_socket(WHY2_CHAT_CODE_INVALID_USERNAME, WHY2_CHAT_SERVER_USERNAME, connection); //TELL THE USER HE IS DUMB AS FUCK
}
if (++usernames_n == WHY2_MAX_USERNAME_TRIES) //ASKED CLIENT WAY TOO FUCKING MANY TIMES FOR USERNAME, KICK HIM
{
exiting = 1;
goto deallocation;
}
}
}