ocaml-cohttp icon indicating copy to clipboard operation
ocaml-cohttp copied to clipboard

Cohttp_lwt_unix.Server.create should indicate when server is running

Open talex5 opened this issue 10 years ago • 2 comments

Currently, it starts listening on the given port and returns a thread that can be cancelled, but there's no way to know when it is ready (i.e. when connections to the socket will succeed). This is important for knowing when clients that want to connect to the server can be started.

talex5 avatar Oct 21 '15 12:10 talex5

The create function ought to block until the socket is ready to accept -- a bug otherwise.

On 21 Oct 2015, at 05:04, Thomas Leonard [email protected] wrote:

Currently, it starts listening on the given port and returns a thread that can be cancelled, but there's no way to know when it is ready (i.e. when connections to the socket will succeed). This is important for knowing when clients that want to connect to the server can be started.

— Reply to this email directly or view it on GitHub https://github.com/mirage/ocaml-cohttp/issues/435.

avsm avatar Oct 21 '15 13:10 avsm

It blocks for the whole time the server is running, not just until it starts.

talex5 avatar Oct 21 '15 13:10 talex5