Megatest

Diff
Login

Differences From Artifact [ac67f901a1]:

To Artifact [d16f0054ce]:


96
97
98
99
100
101
102
103

104
105
106
107
108


109
110
111



112
113
114
115
116
117
118
96
97
98
99
100
101
102

103
104
105
106
107

108
109
110
111
112
113
114
115
116
117
118
119
120
121
122







-
+




-
+
+



+
+
+







;; server:exit           - shutdown the server and exit
;; server:handle-request - take incoming request, process it, send response
;;                         back via best or fastest available transport

;; set up the server area and return a server struct
;; NOTE: This will need to be gated by write-access
;;
(define (server:setup srvtype areapath)
(define (server:setup areapath)
  (let* ((srvdat (make-srv
		  areapath: areapath
		  host:     (get-host-name) ;; likely need to replace with ip address
		  pid:      (current-process-id)
		  type:     srvtype))
		  ;; type:     srvtype
		  ))
	 (srvdir (conc areapath"/.server/"srvtype"/"(get-host.pid srvdat))))
    (srv-dir-set! srvdat srvdir)
    (create-directory srvdir #t)
    (for-each (lambda (d)
		(create-directory (conc srvdir"/"d)))
	      '("incoming" "responses"))
    srvdat))

;; maybe check load before calling this?
(define (server:launch areapath)
  (let* ((logd (conc areapath"/logs"))
	 (logf (conc logd"/from-"(get-host.pid #f)".log")))
    (if (not (file-exists? logd))(create-directory logd #t))