The address of a service to which one can connect. E.g.
Host_and_port.t is a reasonable choice when making a TCP connection.
module Event : sig ... end
val connected : t -> conn Async_kernel.Deferred.t
connected returns the first available connection from the time it is called. When currently connected, the returned deferred is already determined. If
closed has been called, then the returned deferred is never determined.
close t closes the current connection and stops it from trying to reconnect. After the deferred it returns becomes determined, the last connection has been closed and no others will be attempted.
close calls are ever generated internally in response to the connection being closed by the other side.
val close : t -> unit Async_kernel.Deferred.t
close t closes the connection. The returned deferred becomes determined once any resources needed to maintain the connection have been released.
val is_closed : t -> bool
is_closed t returns true if
close has ever been called (even if the returned deferred has not yet been fulfilled).
Note that some modules implementing
Closable may call close internally upon noticing that the connection was closed by the other side. The interface of such a module ought to say that this is the case.
val close_finished : t -> unit Async_kernel.Deferred.t
close_finished t becomes determined at the same time as the result of the first call to
close_finished differs from
close in that it does not have the side effect of initiating a close.
val create : server_name:string -> ?log:Async_unix.Log.t -> ?on_event:(Event.t -> unit Async_kernel.Deferred.t) -> ?retry_delay:(unit -> Core.Time.Span.t) -> connect:(address -> conn Core.Or_error.t Async_kernel.Deferred.t) -> (unit -> address Core.Or_error.t Async_kernel.Deferred.t) -> t