unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Non-blocking web server
@ 2024-03-24 19:41 Ryan Raymond
  2024-03-25  5:31 ` tomas
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ryan Raymond @ 2024-03-24 19:41 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 919 bytes --]

Hello, all.
I was able to build a non-blocking web-server using network sockets.
However, the existing guile web/server.scm implementation is
single-threaded and therefore blocking, which is sub-optimal for some
use-cases.

I suggest we slightly modify the server logic to have an optional
#:blocking? [bool] parameter which would enable behavior in line with the
following excerpt from my own code. Obviously some changes would be made to
methodology and code style, but you get the picture.

(define (listen sock)
  (let* (
    (client-connection (accept sock))
    (client-details (cdr client-connection))
    (client (car client-connection)))
    (begin-thread
      (sigaction SIGPIPE SIG_IGN)
      (handle client)
      (close client))
    ))

This shouldn't cause any backwards-compatibility issues since it's
optional, but the specifics of web/server.scm might cause problems.
Let me know what you think!
Ryan

[-- Attachment #2: Type: text/html, Size: 1099 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-25 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-24 19:41 Non-blocking web server Ryan Raymond
2024-03-25  5:31 ` tomas
2024-03-25  9:24 ` Nala Ginrut
2024-03-25 10:44 ` Maxime Devos

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).