feat(runtime): add integration hardening and diagnostics
This commit is contained in:
@@ -19,6 +19,8 @@ extern "C" {
|
||||
#define MAZE32_GATEWAY_QUEUE_LIMIT 12U
|
||||
#define MAZE32_GATEWAY_OUTGOING_LIMIT 768U
|
||||
#define MAZE32_GATEWAY_RATE_LIMIT_PER_SECOND 20U
|
||||
#define MAZE32_GATEWAY_RATE_LIMIT_CLOSE_THRESHOLD 40U
|
||||
#define MAZE32_GATEWAY_PLAYER_LATENCY_BUDGET_MS 250U
|
||||
|
||||
typedef struct {
|
||||
int active;
|
||||
@@ -26,14 +28,36 @@ typedef struct {
|
||||
uint32_t last_client_sequence;
|
||||
uint64_t rate_window_started_ms;
|
||||
unsigned int messages_in_window;
|
||||
int closing;
|
||||
} maze32_gateway_connection_t;
|
||||
|
||||
typedef struct {
|
||||
int socket_fd;
|
||||
size_t length;
|
||||
int drop_if_busy;
|
||||
char payload[MAZE32_GATEWAY_OUTGOING_LIMIT];
|
||||
} maze32_gateway_outgoing_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t connection_high_water;
|
||||
uint32_t queue_high_water;
|
||||
uint32_t messages_received;
|
||||
uint32_t messages_sent;
|
||||
uint32_t messages_dropped;
|
||||
uint32_t send_failures;
|
||||
uint32_t malformed_messages;
|
||||
uint32_t oversized_messages;
|
||||
uint32_t rate_limited_messages;
|
||||
uint32_t accepted_game_commands;
|
||||
uint32_t matches_started;
|
||||
uint32_t matches_completed;
|
||||
uint32_t matches_reset;
|
||||
uint64_t maximum_handler_us;
|
||||
uint64_t maximum_send_us;
|
||||
size_t minimum_internal_free_bytes;
|
||||
size_t minimum_internal_largest_block_bytes;
|
||||
} maze32_gateway_metrics_t;
|
||||
|
||||
typedef struct {
|
||||
httpd_handle_t server;
|
||||
maze32_lobby_t lobby;
|
||||
@@ -45,6 +69,8 @@ typedef struct {
|
||||
unsigned int suggestion_index;
|
||||
esp_timer_handle_t countdown_timer;
|
||||
esp_timer_handle_t reconnect_timer;
|
||||
esp_timer_handle_t finish_timer;
|
||||
maze32_gateway_metrics_t metrics;
|
||||
maze32_maze_t maze;
|
||||
maze32_maze_workspace_t maze_workspace;
|
||||
maze32_game_t game;
|
||||
@@ -56,6 +82,8 @@ void maze32_gateway_set_server(maze32_gateway_t* gateway, httpd_handle_t server)
|
||||
esp_err_t maze32_gateway_register(httpd_handle_t server, maze32_gateway_t* gateway);
|
||||
void maze32_gateway_close_socket(httpd_handle_t server, int socket_fd);
|
||||
int maze32_gateway_can_reconfigure(const maze32_gateway_t* gateway);
|
||||
size_t maze32_gateway_format_diagnostics(maze32_gateway_t* gateway, char* output,
|
||||
size_t output_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user