Simplified server server-loop
authorTim Vaughan <tgvaughan@gmail.com>
Thu, 22 Aug 2019 07:23:58 +0000 (09:23 +0200)
committerTim Vaughan <tgvaughan@gmail.com>
Thu, 22 Aug 2019 07:23:58 +0000 (09:23 +0200)
scratchy.scm

index 435fe15..0b81523 100644 (file)
              " on " (seconds->string)))
     (condition-case
         (let* ((line (read-line in-port))
-               (selector (string-trim-both line)))
+               (selector-raw (string-trim-both line))
+               (selector (if (= (string-length selector-raw) 0)
+                             "/"
+                             selector-raw)))
           (condition-case
               (begin
                 (with-output-to-port out-port
                   (lambda ()
-                    (serve-selector (if (= (string-length selector) 0)
-                                        "/"
-                                        selector)
-                                    config)))
+                    (serve-selector selector config)))
                 (print "... served selector '" selector "'. Closing connection."))
             (o (exn)
                (print-error-message o out-port)