summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-02-15 22:10:51 +0100
committerAndy Wingo <wingo@pobox.com>2017-02-15 22:10:51 +0100
commit387703aab75cebea2fc874c8240ce844b6c983c4 (patch)
tree3321142e4d8ad81ac735b5e291536245b52a0bd1
parentTweak fibers web socket options (diff)
downloadguile-fibers-387703aab75cebea2fc874c8240ce844b6c983c4.tar.gz
Take advantage of accept4 interface.
* fibers/web/server.scm (client-loop): Setvbuf here. (socket-loop): Use new accept4 interface.
-rw-r--r--fibers/web/server.scm4
1 files changed, 2 insertions, 2 deletions
diff --git a/fibers/web/server.scm b/fibers/web/server.scm
index 72be34b..bd297be 100644
--- a/fibers/web/server.scm
+++ b/fibers/web/server.scm
@@ -180,6 +180,7 @@ on the procedure being called at any particular time."
;; Always disable Nagle's algorithm, as we handle buffering
;; ourselves; when we force-output, we really want the data to go
;; out.
+ (setvbuf client 'block 1024)
(setsockopt client IPPROTO_TCP TCP_NODELAY 1)
(with-throw-handler #t
(lambda ()
@@ -217,10 +218,9 @@ on the procedure being called at any particular time."
(define (socket-loop socket handler)
(let loop ()
- (match (accept socket)
+ (match (accept socket (logior SOCK_NONBLOCK SOCK_CLOEXEC))
((client . sockaddr)
(spawn-fiber (lambda ()
- (set-nonblocking! client)
(client-loop client handler))
#:parallel? #t)
(loop)))))