Connection registry

Now we can use leak sanitizer. Yay!
This commit is contained in:
2025-08-21 18:09:36 -04:00
parent 810b5e006d
commit d1b1e6d589
7 changed files with 500 additions and 34 deletions

View File

@@ -2,6 +2,7 @@
#include "config.hpp"
#include "connection_handler.hpp"
#include "connection_registry.hpp"
#include <atomic>
#include <memory>
#include <span>
@@ -99,8 +100,10 @@ private:
const weaseldb::Config &config_;
ConnectionHandler &handler_;
// Thread management
std::vector<std::thread> threads_;
// Connection registry
ConnectionRegistry connection_registry_;
// Connection management
std::atomic<int64_t> connection_id_{0};
// Round-robin counter for connection distribution
@@ -122,14 +125,14 @@ private:
void setup_signal_handling();
int create_listen_socket();
void create_epoll_instances();
void start_io_threads();
void start_io_threads(std::vector<std::thread> &threads);
void cleanup_resources();
// Helper to get epoll fd for a thread using round-robin
int get_epoll_for_thread(int thread_id) const;
// Helper for processing connection I/O
void process_connection_io(std::unique_ptr<Connection> &conn, int events);
void process_connection_io(std::unique_ptr<Connection> &conn_ptr, int events);
// Helper for processing a batch of connections with their events
void process_connection_batch(int epollfd,