Minor tidying and cleanup

This commit is contained in:
2025-08-22 13:36:17 -04:00
parent 45bf6b6455
commit 815e6c065a
5 changed files with 11 additions and 48 deletions

View File

@@ -319,34 +319,10 @@ private:
* @param fd File descriptor for the socket connection
* @param id Unique connection identifier generated by the server
* @param handler Protocol handler for processing connection data
* @param server Weak reference to the server for safe cleanup
* @param server Reference to server associated with this connection
*/
Connection(struct sockaddr_storage addr, int fd, int64_t id,
size_t epoll_index, ConnectionHandler *handler,
std::weak_ptr<Server> server);
/**
* @brief Server-only factory method for creating connections.
*
* This factory method can only be called by the Server class due to friend
* access. It provides controlled connection creation with proper resource
* management.
*
* @param addr Network address of the remote client (IPv4/IPv6 compatible)
* @param fd File descriptor for the socket connection
* @param id Unique connection identifier generated by the server
* @param handler Protocol handler for processing connection data
* @param server Weak reference to the server for safe cleanup
*
* @return std::unique_ptr<Connection> to the newly created connection
*
* @note This method is only accessible to the Server class and should be used
* exclusively by I/O threads when new connections arrive.
*/
static std::unique_ptr<Connection>
createForServer(struct sockaddr_storage addr, int fd, int64_t id,
size_t epoll_index, ConnectionHandler *handler,
std::weak_ptr<Server> server);
size_t epoll_index, ConnectionHandler *handler, Server &server);
// Networking interface - only accessible by Server
int readBytes(char *buf, size_t buffer_size);