valenok/mongoose — pull request #107 by wmanley (2013-02-25 22:10:28+00:00)
Title:  Add support for passing listening sockets to Mongoose

This adds support for passing listening sockets to Mongoose. This can be
useful when you want more control over how and when sockets are opened.
This is particularly useful when using Mongoose for testing. A helper
executable can be used to open a listening socket on a random port (by
passing 0 as the port to bind to), start mongoose and print the port it is
listening on and the PID it is running as. This information can then be
used later by clients to interact with mongoose before shutting mongoose
down.

We borrow the interface for socket passing from the Linux init system
systemd[1]. The number of sockets for passing is provided by the
environment variable LISTEN_FDS (always 1) and the target PID is given by
LISTEN_PID. These will be used if mongoose is told to listen on the port
"systemd".

[1]: http://www.freedesktop.org/wiki/Software/systemd