package octez-shell-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
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