Manages timers for connection timeouts.
More...
#include <TimerManager.hpp>
Manages timers for connection timeouts.
◆ TimerManager()
| orbit::server::TimerManager::TimerManager |
( |
| ) |
|
◆ add_timer()
| uint64_t orbit::server::TimerManager::add_timer |
( |
int |
fd, |
|
|
std::chrono::milliseconds |
timeout |
|
) |
| |
Adds a timer for a given file descriptor.
- Parameters
-
| fd | The file descriptor. |
| timeout | The timeout duration. |
- Returns
- The timer ID.
◆ cancel_timer()
| void orbit::server::TimerManager::cancel_timer |
( |
uint64_t |
timer_id | ) |
|
Cancels a timer by ID.
- Parameters
-
◆ compact_if_needed_locked()
| void orbit::server::TimerManager::compact_if_needed_locked |
( |
| ) |
|
|
private |
◆ drop_cancelled_front_locked()
| void orbit::server::TimerManager::drop_cancelled_front_locked |
( |
| ) |
|
|
private |
◆ get_next_timeout()
| int orbit::server::TimerManager::get_next_timeout |
( |
| ) |
|
Gets the time remaining until the next timeout.
- Returns
- Milliseconds until the next timeout, or -1 if none.
◆ handle_expired_timers()
| void orbit::server::TimerManager::handle_expired_timers |
( |
std::function< void(int)> |
on_timeout | ) |
|
Processes all expired timers.
- Parameters
-
| on_timeout | Callback invoked for each expired timer with its file descriptor. |
◆ live_timers()
| size_t orbit::server::TimerManager::live_timers |
( |
| ) |
|
Timers that have been added and neither fired nor been cancelled.
◆ pending_entries()
| size_t orbit::server::TimerManager::pending_entries |
( |
| ) |
|
Entries held in the deadline queue, live or cancelled. Bounded by a small multiple of the live timers however often they are re-armed; exposed for tests and diagnostics.
◆ live_
| std::unordered_map<uint64_t, LiveTimer> orbit::server::TimerManager::live_ |
|
private |
◆ mutex_
| std::mutex orbit::server::TimerManager::mutex_ |
|
private |
◆ next_timer_id_
| uint64_t orbit::server::TimerManager::next_timer_id_ {1} |
|
private |
◆ timers_
The documentation for this class was generated from the following file: