Tezos: library for a pool of P2P connections
Library tezos-p2p
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 in trusted_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 ('msg, 'meta, 'meta_conn) t

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.

val activate : ( 'msg, 'meta, 'meta_conn ) t -> unit

activate t starts the worker that will maintain connections

val maintain : ( 'msg, 'meta, 'meta_conn ) t -> unit Lwt.t

maintain t gives a hint to maintenance worker t that maintenance is needed and returns whenever t has done a maintenance cycle.

val shutdown : ( 'msg, 'meta, 'meta_conn ) t -> unit Lwt.t

shutdown t is a thread that returns whenever t has successfully shut down.