guile-devel
[Top][All Lists]
Advanced

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

Non-blocking web server


From: Ryan Raymond
Subject: Non-blocking web server
Date: Sun, 24 Mar 2024 15:41:32 -0400

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

reply via email to

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