tezos-p2p

Tezos: library for a pool of P2P connections
Module Tezos_p2p . P2p_conn
type ('msg, 'peer, 'conn) t
val create : conn:( 'msg P2p_message.t, 'conn ) P2p_socket.t -> point_info:( 'msg, 'peer, 'conn ) t P2p_point_state.Info.t option -> peer_info:( ( 'msg, 'peer, 'conn ) t, 'peer, 'conn ) P2p_peer_state.Info.t -> messages:(int * 'msg) Tezos_stdlib.Lwt_pipe.Maybe_bounded.t -> canceler:Lwt_canceler.t -> greylister:( unit -> unit ) -> callback:'msg P2p_answerer.t -> Tezos_base.TzPervasives.Network_version.t -> ( 'msg, 'peer, 'conn ) t
val peer_id : ( 'msg, 'peer, 'conn ) t -> Tezos_base.TzPervasives.P2p_peer.Id.t
val private_node : ( 'msg, 'peer, 'conn ) t -> bool

private_node t returns 'true' if the node associated to this connection is in private mode

val trusted_node : ( 'msg, 'peer, 'conn ) t -> bool

trusted_node t returns 'true' if the node associated to this connection is trusted

val info : ( 'msg, 'peer, 'conn ) t -> 'conn Tezos_base.TzPervasives.P2p_connection.Info.t
val local_metadata : ( 'msg, 'peer, 'conn ) t -> 'conn
val remote_metadata : ( 'msg, 'peer, 'conn ) t -> 'conn
val stat : ( 'msg, 'peer, 'conn ) t -> Tezos_base.TzPervasives.P2p_stat.t

stat t is a snapshot of current bandwidth usage for t.

val read : ( 'msg, 'peer, 'conn ) t -> 'msg Tezos_base.TzPervasives.tzresult Lwt.t

read t returns a message popped from t's app message queue, or fails with Connection_closed.

val is_readable : ( 'msg, 'peer, 'conn ) t -> unit Tezos_base.TzPervasives.tzresult Lwt.t

is_readable t returns when there is at least one message ready to be read.

val write_bootstrap : ( 'msg, 'peer, 'conn ) t -> bool Tezos_base.TzPervasives.tzresult
val write : ( 'msg, 'peer, 'conn ) t -> 'msg -> unit Tezos_base.TzPervasives.tzresult Lwt.t

write t msg is P2p_socket.write t' msg where t' is the internal P2p_socket.t inside t.

val write_sync : ( 'msg, 'peer, 'conn ) t -> 'msg -> unit Tezos_base.TzPervasives.tzresult Lwt.t

write_sync t msg is P2p_socket.write_sync t' msg where t' is the internal P2p_socket.t inside t.

val write_now : ( 'msg, 'peer, 'conn ) t -> 'msg -> bool Tezos_base.TzPervasives.tzresult

write_now t msg is P2p_socket.write_now t' msg where t' is the internal P2p_socket.t inside t.

val equal_sock : ( 'msg, 'peer, 'conn ) t -> ( 'msg, 'peer, 'conn ) t -> bool
val disconnect : ?wait:bool -> ( 'msg, 'peer, 'conn ) t -> unit Lwt.t
val negotiated_version : ( 'msg, 'peer, 'conn ) t -> Tezos_base.TzPervasives.Network_version.t

Returns the network version that will be used for this connection. This network version is the best version compatible with the versions supported by ours and the remote peer.

val close : ( 'msg, 'peer, 'conn ) t -> unit Lwt.t