From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vivien Kraus Newsgroups: gmane.lisp.guile.user Subject: Fibers web server: use multiple server sockets Date: Wed, 02 Nov 2022 17:37:20 +0100 Message-ID: <3a4e6dc328e3c5f8fe485653da8c4d1475943074.camel@planete-kraus.eu> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2563"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.46.0 To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Nov 02 17:38:22 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oqGkw-0000Rb-8t for guile-user@m.gmane-mx.org; Wed, 02 Nov 2022 17:38:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqGkF-0002Yb-NV; Wed, 02 Nov 2022 12:37:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqGkA-0002Xf-2i for guile-user@gnu.org; Wed, 02 Nov 2022 12:37:35 -0400 Original-Received: from planete-kraus.eu ([2a00:5881:4008:2810::309]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1oqGk8-0008Tb-6u for guile-user@gnu.org; Wed, 02 Nov 2022 12:37:33 -0400 Original-Received: from planete-kraus.eu (localhost.lan [127.0.0.1]) by planete-kraus.eu (OpenSMTPD) with ESMTP id 27a37874 for ; Wed, 2 Nov 2022 16:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=planete-kraus.eu; h= message-id:subject:from:to:date:content-type :content-transfer-encoding:mime-version; s=dkim; bh=9OXQl9Eo0Za8 RXzpqPp9FcmN3So=; b=twpQemfICM5X0CeRbCph6HLytxSlxVyXLrgZ0NQjqnfR ABFa4gKqS8Gg3ZLm7RxuS53rmMrq/kprb/2eBJIemlxN3y4DQA156YhPfnjZnctA 6WHymYL/mFJ5B9y6Pu1Vb1MA4KQXBzGCtuFf8/vnMXvxeNwAWlLeKa/6VexNOXw= Original-Received: by planete-kraus.eu (OpenSMTPD) with ESMTPSA id 6777bd87 (TLSv1.3:AEAD-CHACHA20-POLY1305-SHA256:256:NO) for ; Wed, 2 Nov 2022 16:37:22 +0000 (UTC) Received-SPF: pass client-ip=2a00:5881:4008:2810::309; envelope-from=vivien@planete-kraus.eu; helo=planete-kraus.eu X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "guile-user" Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:18684 Archived-At: 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 =E2=80=9Clisten=E2=80=9D, =E2=80=9Cfcntl=E2=80= =9D (for set-nonblocking!) and =E2=80=9Caccept=E2=80=9D generic (with parameters, or GOOPS, or=E2=80=A6?) = so that I could fit my weird thing within the call to accept. Ultimately, everything could be expressed in terms of =E2=80=9Caccept=E2=80= =9D and have the default implementation call listen and set-nonblocking! lazily during the first call to accept.=C2=A0 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