From afb73d7437083500bf31c88b78f041e7e6ab0252 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 15 Feb 2017 21:31:57 +0100 Subject: Tweak fibers web socket options * fibers/web/server.scm (client-loop): Move NODELAY things here and actually enable NODELAY (before we were... disabling it???). (socket-loop): Remove SNDBUF munging; let's assume it doesn't matter rather than the reverse. --- fibers/web/server.scm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/fibers/web/server.scm b/fibers/web/server.scm index dbca90d..72be34b 100644 --- a/fibers/web/server.scm +++ b/fibers/web/server.scm @@ -177,6 +177,10 @@ on the procedure being called at any particular time." (else #f))))) (define (client-loop client handler) + ;; Always disable Nagle's algorithm, as we handle buffering + ;; ourselves; when we force-output, we really want the data to go + ;; out. + (setsockopt client IPPROTO_TCP TCP_NODELAY 1) (with-throw-handler #t (lambda () (let loop () @@ -215,13 +219,6 @@ on the procedure being called at any particular time." (let loop () (match (accept socket) ((client . sockaddr) - ;; From "HOP, A Fast Server for the Diffuse Web", Serrano. - (setsockopt client SOL_SOCKET SO_SNDBUF (* 12 1024)) - ;; Always disable Nagle's algorithm, as we handle buffering - ;; ourselves. Ignore exceptions if it's not a TCP port, or - ;; TCP_NODELAY is not defined on this platform. - (false-if-exception - (setsockopt client IPPROTO_TCP TCP_NODELAY 0)) (spawn-fiber (lambda () (set-nonblocking! client) (client-loop client handler)) -- cgit v1.2.3