unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Vivien Kraus <vivien@planete-kraus.eu>
To: guile-user <guile-user@gnu.org>
Subject: Fibers web server: use multiple server sockets
Date: Wed, 02 Nov 2022 17:37:20 +0100	[thread overview]
Message-ID: <3a4e6dc328e3c5f8fe485653da8c4d1475943074.camel@planete-kraus.eu> (raw)

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	other threads:[~2022-11-02 16:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02 16:37 Vivien Kraus [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-11-02 18:15 Fibers web server: use multiple server sockets dsmich
2022-11-02 18:27 ` Vivien Kraus
2022-11-02 19:19 ` tomas
2022-11-02 19:35   ` Dr. Arne Babenhauserheide
2022-11-02 19:57     ` tomas
2022-11-02 23:04       ` Ricardo Wurmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3a4e6dc328e3c5f8fe485653da8c4d1475943074.camel@planete-kraus.eu \
    --to=vivien@planete-kraus.eu \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).