|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
Global client manager structure for server-side client coordination. More...
#include <src/server/client.h>
Data Fields | |
| client_info_t | clients [MAX_CLIENTS] |
| Array of client_info_t structures (backing storage) | |
| client_info_t * | clients_by_id |
| uthash head pointer for O(1) client_id -> client_info_t* lookups | |
| int | client_count |
| Current number of active clients. | |
| mutex_t | mutex |
| Legacy mutex (mostly replaced by rwlock) | |
| _Atomic uint32_t | next_client_id |
| Monotonic counter for unique client IDs (atomic for thread-safety) | |
Global client manager structure for server-side client coordination.
Manages all connected clients in the ascii-chat server. Provides O(1) client lookup via hashtable while maintaining array-based storage for iteration. This structure serves as the central coordination point for client lifecycle management.
The client manager uses a dual-storage approach:
This design provides:
Protected by g_client_manager_rwlock (reader-writer lock):
LOCK ORDERING:
Definition at line 63 of file src/server/client.h.
| int client_manager_t::client_count |
Current number of active clients.
Definition at line 69 of file src/server/client.h.
Referenced by broadcast_server_state_to_all_clients().
| client_info_t client_manager_t::clients[MAX_CLIENTS] |
Array of client_info_t structures (backing storage)
Definition at line 65 of file src/server/client.h.
Referenced by any_clients_sending_video(), broadcast_server_state_to_all_clients(), find_client_by_socket(), send_server_state_to_client(), server_main(), stats_logger_thread(), and update_server_stats().
| client_info_t* client_manager_t::clients_by_id |
uthash head pointer for O(1) client_id -> client_info_t* lookups
Definition at line 67 of file src/server/client.h.
Referenced by __attribute__(), and server_main().
| mutex_t client_manager_t::mutex |
Legacy mutex (mostly replaced by rwlock)
Definition at line 71 of file src/server/client.h.
Referenced by server_main().
| _Atomic uint32_t client_manager_t::next_client_id |
Monotonic counter for unique client IDs (atomic for thread-safety)
Definition at line 73 of file src/server/client.h.