Megatest

Check-in [8177baef75]
Login
Overview
Comment:wip
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.6584-ck5
Files: files | file ages | folders
SHA1: 8177baef756c9ed01ee4f46fdd01d6793342166b
User & Date: matt on 2021-04-13 00:04:18
Other Links: branch diff | manifest | tags
Context
2021-04-13
23:55
wip check-in: d46b3c0e7d user: matt tags: v1.6584-ck5
00:04
wip check-in: 8177baef75 user: matt tags: v1.6584-ck5
2021-04-12
23:53
wip check-in: 38bad7dc9b user: matt tags: v1.6584-ck5
Changes

Modified http-transportmod.scm from [c6713e9175] to [194fbe34ee].

121
122
123
124
125
126
127



128
129
130
131
132
133
134
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137







+
+
+







;; S E R V E R
;; ======================================================================

;; Call this to start the actual server
;;

(define *db:process-queue-mutex* (make-mutex))
(define *http-functions* (make-hash-table))
(define (http-get-function fnkey)
  (hash-table-ref/default *http-functions* fnkey (lambda () "nothing here yet")))

(define (http-transport:run hostn)
  ;; Configurations for server
  (tcp-buffer-size 2048)
  (max-connections 2048) 
  (debug:print 2 *default-log-port* "Attempting to start the server ...")
  (let* ((db              #f) ;;        (open-db)) ;; we don't want the server to be opening and closing the db unnecesarily
162
163
164
165
166
167
168
169
170



171
172
173
174
175
176

177
178
179

180
181
182

183
184
185
186
187
188
189
190
191
192
193

194
195
196
197

198
199
200
201

202
203
204
205
206
207
208
165
166
167
168
169
170
171


172
173
174
175
176
177
178
179

180
181
182

183
184
185

186
187
188
189
190
191
192
193
194
195
196

197
198
199
200

201
202
203
204

205
206
207
208
209
210
211
212







-
-
+
+
+





-
+


-
+


-
+










-
+



-
+



-
+







				 ;; This is were we set up the database connections
			       (let* (($   (request-vars source: 'both))
				      (dat ($ 'dat))
				      (res #f))
				 (cond
				  ((equal? (uri-path (request-uri (current-request)))
					   '(/ "api"))
				   (send-response body:    (api:process-request *dbstruct-db* $) ;; the $ is the request vars proc
						  headers: '((content-type text/plain)))
				   (send-response ;; the $ is the request vars proc
				    body: ((http-get-function 'api:process-request) *dbstruct-db* $)
				    headers: '((content-type text/plain)))
				   (mutex-lock! *heartbeat-mutex*)
				   (set! *db-last-access* (current-seconds))
				   (mutex-unlock! *heartbeat-mutex*))
				  ((equal? (uri-path (request-uri (current-request))) 
					   '(/ ""))
				   (send-response body: (http-transport:main-page)))
				   (send-response body: ((http-get-function 'http-transport:main-page))))
				  ((equal? (uri-path (request-uri (current-request))) 
					   '(/ "json_api"))
				   (send-response body: (http-transport:main-page)))
				   (send-response body: (http-get-function '(http-transport:main-page))))
				  ((equal? (uri-path (request-uri (current-request))) 
					   '(/ "runs"))
				   (send-response body: (http-transport:main-page)))
				   (send-response body: (http-get-function '(http-transport:main-page))))
				  ((equal? (uri-path (request-uri (current-request))) 
					   '(/ any))
				   (send-response body: "hey there!\n"
						  headers: '((content-type text/plain))))
				  ((equal? (uri-path (request-uri (current-request))) 
					   '(/ "hey"))
				   (send-response body: "hey there!\n" 
						  headers: '((content-type text/plain))))
                                  ((equal? (uri-path (request-uri (current-request))) 
					   '(/ "jquery3.1.0.js"))
				   (send-response body: (http-transport:show-jquery) 
				   (send-response body: (http-get-function '(http-transport:show-jquery)) 
						  headers: '((content-type application/javascript))))
                                  ((equal? (uri-path (request-uri (current-request))) 
					   '(/ "test_log"))
				   (send-response body: (http-transport:html-test-log $) 
				   (send-response body: (http-get-function '(http-transport:html-test-log $) )
						  headers: '((content-type text/HTML))))    
                                  ((equal? (uri-path (request-uri (current-request))) 
					   '(/ "dashboard"))
				   (send-response body: (http-transport:html-dboard $) 
				   (send-response body: (http-get-function '(http-transport:html-dboard $) )
						  headers: '((content-type text/HTML)))) 
				  (else (continue))))))))
    (handle-exceptions
	exn
      (debug:print 0 *default-log-port* "Failed to create file " start-file ", exn=" exn)
      (with-output-to-file start-file (lambda ()(print (current-process-id)))))
    (http-transport:try-start-server ipaddrstr start-port)))

Modified servermod.scm from [9108fdbf1d] to [04c0b87ce1].

34
35
36
37
38
39
40

41
42
43
44
45
46
47
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48







+







	chicken.io
	chicken.time
	chicken.condition
	chicken.file
	chicken.process-context
	chicken.process-context.posix
	chicken.random
	chicken.file.posix
	
	system-information
	(prefix sqlite3 sqlite3:)
	typed-records
	regex
	directory-utils
	matchable