Module Mavryk_p2p.P2p_welcome

Welcome worker.

Accept incoming connections and add them to the pool.

type t

Type of a welcome worker.

val create : ?reuse_port:bool -> ?addr:Mavryk_base.TzPervasives.P2p_addr.t -> backlog:int -> ('msg, 'meta, 'meta_conn) P2p_connect_handler.t -> Mavryk_base.TzPervasives.P2p_addr.port -> t Mavryk_base.TzPervasives.tzresult Lwt.t

create ?reuse_port ?addr ~backlog pool port returns a running welcome worker adding connections into pool listening on addr:port. backlog is passed to Lwt_unix.listen.

reuse_port should be used for testing purposes. This option sets SO_REUSEPORT on the socket, allowing to reuse a port opened elsewhere.

val activate : t -> unit

activate t start the worker that will accept connections

val shutdown : t -> unit Lwt.t

shutdown t returns when t has completed shutdown.