Orbit Framework
An ultra-modern, asynchronous, cross-platform C++ Web Framework.
Loading...
Searching...
No Matches
EventLoop.hpp
Go to the documentation of this file.
1#pragma once
11#ifdef ORBIT_ENABLE_HTTP3
13#else
14namespace server { class QuicConnectionManager; }
15#endif
16#include <atomic>
17
18namespace server {
19
23class EventLoop {
24public:
34 EventLoop(Listener& listener, const routing::Router& router, const config::ServerConfig& config, network::TlsContext* tls_context = nullptr, network::UdpSocket* quic_socket = nullptr, QuicConnectionManager* quic_manager = nullptr);
35
44 void run();
45
49 void stop();
50
54 void stop_accepting();
55
60 concurrency::ThreadPool& get_thread_pool() { return thread_pool_; }
61
62private:
63 void do_accept();
64 void do_read_quic();
65
66 Listener& listener_;
67 TimerManager timer_manager_;
68 std::unique_ptr<network::Proactor> proactor_;
69 concurrency::ThreadPool thread_pool_;
70 ConnectionManager connection_manager_;
71 network::UdpSocket* quic_socket_;
72 QuicConnectionManager* quic_manager_;
73
74
75 std::atomic<bool> is_running_{true};
76 std::atomic<bool> is_accepting_{true};
77};
78
79} // namespace server
Definition ThreadPool.hpp:12
Definition TlsContext.hpp:10
Definition UdpSocket.hpp:7
Manages routing of HTTP requests to their appropriate handlers.
Definition Router.hpp:30
Manages active HTTP connections.
Definition ConnectionManager.hpp:17
Manages the server's event loop, handling I/O operations and dispatching tasks.
Definition EventLoop.hpp:23
concurrency::ThreadPool & get_thread_pool()
Gets the thread pool.
Definition EventLoop.hpp:60
void stop_accepting()
Stops accepting new connections but continues processing existing ones.
Definition EventLoop.cpp:73
void run()
Starts the event loop.
Definition EventLoop.cpp:45
void stop()
Stops the event loop.
Definition EventLoop.cpp:69
Listens for incoming network connections.
Definition Listener.hpp:11
Manages QUIC connections.
Definition QuicConnectionManager.hpp:36
Manages timers for connection timeouts.
Definition TimerManager.hpp:29
Definition Config.hpp:5
Definition Http2Session.hpp:17
Definition Config.hpp:18