std::unique_ptr<Connection> -> Ref<Connection>

This commit is contained in:
2025-09-12 18:31:57 -04:00
parent 1fa3381e4b
commit de6f38694f
11 changed files with 79 additions and 92 deletions

View File

@@ -106,7 +106,7 @@ struct Server {
*
* @param connection unique_ptr to the connection being released back
*/
static void release_back_to_server(std::unique_ptr<Connection> connection);
static void release_back_to_server(Ref<Connection> connection);
private:
friend struct Connection;
@@ -158,14 +158,11 @@ private:
int get_epoll_for_thread(int thread_id) const;
// Helper for processing connection I/O
void process_connection_reads(std::unique_ptr<Connection> &conn_ptr,
int events);
void process_connection_writes(std::unique_ptr<Connection> &conn_ptr,
int events);
void process_connection_reads(Ref<Connection> &conn_ptr, int events);
void process_connection_writes(Ref<Connection> &conn_ptr, int events);
// Helper for processing a batch of connections with their events
void process_connection_batch(int epollfd,
std::span<std::unique_ptr<Connection>> batch,
void process_connection_batch(int epollfd, std::span<Ref<Connection>> batch,
std::span<const int> events);
/**
@@ -176,7 +173,7 @@ private:
*
* @param connection Unique pointer to the connection being released back
*/
void receiveConnectionBack(std::unique_ptr<Connection> connection);
void receiveConnectionBack(Ref<Connection> connection);
// Make non-copyable and non-movable
Server(const Server &) = delete;