guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fibers web server: use multiple server sockets


From: Vivien Kraus
Subject: Fibers web server: use multiple server sockets
Date: Wed, 02 Nov 2022 17:37:20 +0100
User-agent: Evolution 3.46.0

Dear guile fiber users,

Fibers is a library that I would very much like to use. It provides a
nice web server. However, as I recently discovered, in a standard
GNU/Linux server, not all network interfaces and addresses are up when
the server is about to start (especially so with dhcp). I have a nice
solution for that: every now and then, the server calls getaddrinfo. If
a previously bound address does not appear anymore in the return value,
then close the socket it was bound to. If a new address is returned by
the function, create a new socket for it and bind it to the new address
(and listen). This means that if a new address appears for the host
argument, then the server will eventually listen to it without having
to restart anything. If an address is dropped, eventually the server
will stop listening to it.

I would like to have that in the fibers web server. However, I
understand that not everyone would want it, or some would do it
differently (e.g. by using guile-netlink or something else). I think
the web server should make “listen”, “fcntl” (for set-nonblocking!) and
“accept” generic (with parameters, or GOOPS, or…?) so that I could fit
my weird thing within the call to accept.
Ultimately, everything could be expressed in terms of “accept” and have
the default implementation call listen and set-nonblocking! lazily
during the first call to accept. 

What do you think? Should the fibers web server try to do the
getaddrinfo thing by itself or be extensible and let me do it myself?
Are you OK with GOOPS? Do you prefer parameters? Do you have other
options?

Best regards,

Vivien



reply via email to

[Prev in Thread] Current Thread [Next in Thread]