Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module Lwt_io.Versioned

module Versioned : sig..end

Versioned variants of APIs undergoing breaking changes.


val establish_server_1 : 
  ?fd:Lwt_unix.file_descr ->
  ?buffer_size:int ->
  ?backlog:int ->
  Unix.sockaddr ->
  (Lwt_io.input_channel * Lwt_io.output_channel -> unit) ->
  Lwt_io.server

Deprecated.Use Lwt_io.Versioned.establish_server_2. Alias for the current Lwt_io.establish_server. Since 2.7.0

val establish_server_2 : 
  ?fd:Lwt_unix.file_descr ->
  ?buffer_size:int ->
  ?backlog:int ->
  ?no_close:bool ->
  Unix.sockaddr ->
  (Lwt_io.input_channel * Lwt_io.output_channel -> unit Lwt.t) ->
  Lwt_io.server Lwt.t

establish_server_2 sockaddr f creates a server which listens for incoming connections. New connections are passed to f. When threads returned by f complete, the connections are closed automatically. To prevent automatic closing, apply establish_server_2 with ~no_close:true.

The ?fd and ?backlog arguments have the same meaning as in Lwt_io.establish_server. ?buffer_size sets the internal buffer size of the channels passed to f.

The server does not wait for each thread. It begins accepting new connections immediately.

If a thread raises an exception, it is passed to !Lwt.async_exception_hook. Likewise, if the automatic close of a connection raises an exception, it is passed to !Lwt.async_exception_hook. To robustly handle these exceptions, you should call close manually inside f, and use your own handler. Since 2.7.0

val shutdown_server_1 : Lwt_io.server -> unit

Deprecated.Use Lwt_io.Versioned.shutdown_server_2. Alias for the current Lwt_io.shutdown_server. Since 2.7.0

val shutdown_server_2 : Lwt_io.server -> unit Lwt.t

Closes the given server's listening socket. The thread returned by this function waits for the underlying close system call to complete.

This function does not affect sockets of connections that have already been accepted by the server, i.e. those passed by establish_server to its callback f. Since 2.7.0