livery_grpc_listener (livery_grpc v0.1.1)
View SourceOwns a gRPC h2 listener, supervised under livery_grpc_server_sup.
The h2 listen socket is owned by whichever process calls h2:start_server,
so it must be a long-lived one or the socket closes with it. This
gen_server is that owner: it opens the listener in init and holds it for
the lifetime of the supervised child, so a server started from a transient
caller (a test's init_per_suite, a short request) keeps running.
Summary
Types
-type start_opts() :: #{h2_opts := map()}.
Functions
-spec init(start_opts()) -> {ok, map()} | {stop, term()}.
-spec listener(pid()) -> livery_h2:listener().
The underlying h2 listener handle.
-spec port(pid()) -> inet:port_number().
The TCP port the listener is bound to.
-spec start_link(start_opts()) -> {ok, pid()} | {error, term()}.