Megatest

Check-in [ff7e665911]
Login
Overview
Comment:server:setup additions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.80-reshape
Files: files | file ages | folders
SHA1: ff7e6659111323b5bf6172b1cb3385960f1842d9
User & Date: mrwellan on 2023-01-27 17:01:33
Other Links: branch diff | manifest | tags
Context
2023-01-27
18:32
Merged from v1.80 check-in: 3d8270b891 user: matt tags: v1.80-reshape
17:01
server:setup additions check-in: ff7e665911 user: mrwellan tags: v1.80-reshape
2023-01-25
07:34
Synced in ulex from v2.0001 check-in: 6e38a56108 user: mrwellan tags: v1.80-reshape
Changes

Modified servermod.scm from [ac67f901a1] to [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))