fix: two-player lobby deadlock

This commit is contained in:
2026-08-30 23:42:26 +03:00
parent d5eb26d330
commit 93af738e36
9 changed files with 77 additions and 10 deletions
+2 -1
View File
@@ -206,6 +206,7 @@ static bool parse_join(const http_api_request_t *request, char name[kDisplayName
if (strcmp(role_value, "player1") == 0) *role = ROLE_PLAYER_1;
else if (strcmp(role_value, "player2") == 0) *role = ROLE_PLAYER_2;
else if (strcmp(role_value, "spectator") == 0) *role = ROLE_SPECTATOR;
else if (strcmp(role_value, "player") == 0) *role = ROLE_AUTO_PLAYER;
else *role = (role_t)UINT8_MAX;
return true;
}
@@ -353,7 +354,7 @@ bool http_api_handle(http_api_t *api, const http_api_request_t *request, http_ap
response_error(response, 400U, "MALFORMED_JSON", "Некорректный JSON", version);
return true;
}
if (role > ROLE_SPECTATOR) {
if (role > ROLE_AUTO_PLAYER) {
response_error(response, 400U, "INVALID_ROLE", "Некорректная роль", version);
return true;
}