discv4::DialScheduler¶
Per-chain dial scheduler mirroring go-ethereum's dialScheduler. Maintains up to pool->max_per_chain concurrent dial coroutines, respecting the global pool->max_total cap across all chains. All methods run on the single io_context thread — no mutex needed.
#include <dial_scheduler.hpp>
Inherits from std::enable_shared_from_this< DialScheduler >
Public Functions¶
| Name | |
|---|---|
| DialScheduler(boost::asio::io_context & io_, std::shared_ptr< WatcherPool > pool_, DialFn dial_fn_) | |
| void | enqueue(ValidatedPeer vp) Enqueue a validated peer for dialing. If a slot is free (both per-chain and global caps), spawns immediately. Otherwise queues for later drain. |
| void | release() Called by every dial exit path. Recycles the slot and drains the queue up to the available capacity. |
| void | stop() Async stop — disconnect all active sessions immediately. Returns immediately; fds are freed on the next io_context cycle. |
Public Attributes¶
| Name | |
|---|---|
| boost::asio::io_context & | io |
| std::shared_ptr< WatcherPool > | pool |
| DialFn | dial_fn |
| FilterFn | filter_fn Optional peer filter; nullptr = accept all. |
| std::shared_ptr< DialHistory > | dial_history |
| int | active |
| int | validated_count currently active validated connections |
| int | total_validated cumulative count (never decrements) |
| bool | stopping |
| std::deque< ValidatedPeer > | queue |
| std::vector< std::weak_ptr< rlpx::RlpxSession > > | active_sessions |
Public Functions Documentation¶
function DialScheduler¶
inline DialScheduler(
boost::asio::io_context & io_,
std::shared_ptr< WatcherPool > pool_,
DialFn dial_fn_
)
function enqueue¶
Enqueue a validated peer for dialing. If a slot is free (both per-chain and global caps), spawns immediately. Otherwise queues for later drain.
function release¶
Called by every dial exit path. Recycles the slot and drains the queue up to the available capacity.
function stop¶
Async stop — disconnect all active sessions immediately. Returns immediately; fds are freed on the next io_context cycle.
Public Attributes Documentation¶
variable io¶
variable pool¶
variable dial_fn¶
variable filter_fn¶
Optional peer filter; nullptr = accept all.
variable dial_history¶
variable active¶
variable validated_count¶
currently active validated connections
variable total_validated¶
cumulative count (never decrements)
variable stopping¶
variable queue¶
variable active_sessions¶
Updated on 2026-04-13 at 23:22:46 -0700