web: Rename getters / accessors to use dot prefix.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 15 Jan 2017 15:29:16 +0000 (09:29 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 15 Jan 2017 15:39:52 +0000 (09:39 -0600)
* 8sync/systems/web.scm (<web-server>, .host, .family, .port-num)
(.addr, .socket, .http-handler): Rename getters/accessors from
web-server- prefix to dot prefix.
(web-server-socket-loop, web-server-handle-request, web-server-cleanup):
Update callers.

8sync/systems/web.scm

index 597fd008574be22775837f9fe8695b1e6e12dc9c..82ed4d20985b9c80deab018bdc556866ca424681 100644 (file)
 
   (host #:init-value #f
         #:init-keyword #:host
-        #:getter web-server-host)
+        #:getter .host)
   (family #:init-value AF_INET
           #:init-keyword #:family
-          #:getter web-server-family)
+          #:getter .family)
   (port-num #:init-value 8080
             #:init-keyword #:port
-            #:getter web-server-port-num)
+            #:getter .port-num)
   (addr #:init-keyword #:addr
-        #:accessor web-server-addr)
+        #:accessor .addr)
   (socket #:init-value #f
-          #:accessor web-server-socket)
+          #:accessor .socket)
   (upgrade #:init-value '()
            #:allocation #:each-subclass)
   (http-handler #:init-keyword #:http-handler
-                #:getter web-server-http-handler))
+                #:getter .http-handler))
 
 (define-method (initialize (web-server <web-server>) init-args)
   (next-method)
   ;; Make sure the addr is set up
   (when (not (slot-bound? web-server 'addr))
-    (set! (web-server-addr web-server)
-          (if (web-server-host web-server)
-              (inet-pton (web-server-family web-server)
-                         (web-server-host web-server))
+    (set! (.addr web-server)
+          (if (.host web-server)
+              (inet-pton (.family web-server)
+                         (.host web-server))
               INADDR_LOOPBACK)))
 
   ;; Set up the socket
-  (set! (web-server-socket web-server)
-        (make-default-socket (web-server-family web-server)
-                             (web-server-addr web-server)
-                             (web-server-port-num web-server)))
+  (set! (.socket web-server)
+        (make-default-socket (.family web-server)
+                             (.addr web-server)
+                             (.port-num web-server)))
 
   ;; This is borrowed from Guile's web server.
   ;; Andy Wingo added the line with this commit:
   "The main loop on our socket.  Keep accepting new clients as long
 as we're alive."
   (while #t
-    (match (accept (web-server-socket web-server))
+    (match (accept (.socket web-server))
       ((client . sockaddr)
        ;; From "HOP, A Fast Server for the Diffuse Web", Serrano.
        (setsockopt client SOL_SOCKET SO_SNDBUF (* 12 1024))
@@ -173,14 +173,14 @@ as we're alive."
 (define (web-server-handle-request web-server message
                                    request body)
   (receive (response body)
-      ((web-server-http-handler web-server) request body)
+      ((.http-handler web-server) request body)
     (receive (response body)
         (sanitize-response request response body)
       (<-reply message response body))))
 
 (define (web-server-cleanup web-server message)
   ;; @@: Should we close any pending requests too?
-  (close (web-server-socket web-server)))
+  (close (.socket web-server)))
 
 (define (web-server-shutdown web-server message)
   (self-destruct web-server))