package octez-shell-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=c6df840ebbf115e454db949028c595bec558a59a66cade73b52a6d099d6fa4d4
sha512=d8aee903b9fe130d73176bc8ec38b78c9ff65317da3cb4f3415f09af0c625b4384e7498201fdb61aa39086a7d5d409d0ab3423f9bc3ab989a680cf444a79bc13
doc/octez-shell-libs.p2p/Tezos_p2p/P2p_maintenance/index.html
Module Tezos_p2p.P2p_maintenance
Source
P2P maintenance worker.
This worker enforces the connection bounds defined on the command-line or/and the configuration file.
The maintenance process is launched: . When any of the following future is resolved P2p_trigger.wait_too_few_connections
P2p_trigger.wait_too_many_connections
. When maintain
is called . After maintenance_idle_time
if none of the other conditions have been met.
If the number of connections is above the limit, the maintainer kills existing connections.
If below the limit, it tries to connect to points available from P2p_pool
. If not enough connections can be obtained, it requests new points from P2p_pool
using P2p_pool.broadcast msg
, and wakes up the P2p_discovery
worker. It then waits for new peers or points by waiting on futures P2p_trigger.wait_new_peer
P2p_trigger.wait_new_point
This is reiterated indefinitely every require_new_points_time
.
type config = {
maintenance_idle_time : Tezos_base.TzPervasives.Time.System.Span.t;
(*How long to wait at most before running a maintenance loop.
*)private_mode : bool;
(*If
*)true
, only open outgoing/accept incoming connections to/from peers whose addresses are intrusted_peers
, and inform these peers that the identity of this node should be revealed to the rest of the network.min_connections : int;
(*Strict minimum number of connections
*)max_connections : int;
(*Maximum number of connections
*)expected_connections : int;
(*Targeted number of connections to reach
*)time_between_looking_for_peers : Ptime.span;
(*The maximum time between two bootstrap message broadcasts when there are not enough active connections and no new peer or point have been discovered.
*)
}
Type of a maintenance worker.
val create :
?discovery:P2p_discovery.t ->
config ->
('msg, 'meta, 'meta_conn) P2p_pool.t ->
('msg, 'meta, 'meta_conn) P2p_connect_handler.t ->
P2p_trigger.t ->
log:(Tezos_base.TzPervasives.P2p_connection.P2p_event.t -> unit) ->
('msg, 'meta, 'meta_conn) t
create ?discovery config pool triggers log
returns a maintenance worker, with the discovery
worker if present, for pool
.
activate t
starts the worker that will maintain connections.
maintain t
gives a hint to maintenance worker t
that maintenance is needed and returns whenever t
has done a maintenance cycle.
shutdown t
is a thread that returns whenever t
has successfully shut down.
enable or disable maintenance triggers. For tests only