Orbit Framework
An ultra-modern, asynchronous, cross-platform C++ Web Framework.
Loading...
Searching...
No Matches
ConnectionManager.hpp
Go to the documentation of this file.
1#pragma once
8#include <unordered_map>
9#include <memory>
10#include <mutex>
11
12namespace server {
13
18public:
28 ConnectionManager(network::Proactor& proactor, const routing::Router& router, concurrency::ThreadPool& thread_pool, TimerManager& timer_manager, size_t max_body_size, network::TlsContext* tls_context = nullptr);
29
35 void add_connection(network::Socket socket, const std::string& client_ip);
36
41 void remove_connection(int fd);
42
47 size_t get_connection_count() const;
48
49private:
50 network::Proactor& proactor_;
51 const routing::Router& router_;
52 concurrency::ThreadPool& thread_pool_;
53 TimerManager& timer_manager_;
54
55 std::unordered_map<int, std::shared_ptr<Connection>> connections_;
56 mutable std::mutex map_mutex_;
57 size_t max_body_size_;
58 network::TlsContext* tls_context_;
59};
60
61} // namespace server
Definition ThreadPool.hpp:12
Definition Proactor.hpp:8
Definition Socket.hpp:6
Definition TlsContext.hpp:10
Manages routing of HTTP requests to their appropriate handlers.
Definition Router.hpp:30
Manages active HTTP connections.
Definition ConnectionManager.hpp:17
void add_connection(network::Socket socket, const std::string &client_ip)
Adds a new connection to the manager.
Definition ConnectionManager.cpp:10
size_t get_connection_count() const
Gets the current number of active connections.
Definition ConnectionManager.cpp:46
void remove_connection(int fd)
Removes a connection by file descriptor.
Definition ConnectionManager.cpp:27
Manages timers for connection timeouts.
Definition TimerManager.hpp:29
Definition Http2Session.hpp:17