Overview
Comment: | wip |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v2.0001-ulex-one-shot |
Files: | files | file ages | folders |
SHA1: |
eccf4ded3fb3562019e5859314a8a45f |
User & Date: | matt on 2022-01-14 08:13:45 |
Other Links: | branch diff | manifest | tags |
Context
2022-01-14
| ||
08:15 | Merged changes from v2.0001 check-in: 3253e6faaa user: matt tags: v2.0001-ulex-one-shot | |
08:13 | wip check-in: eccf4ded3f user: matt tags: v2.0001-ulex-one-shot | |
2022-01-13
| ||
06:18 | wip check-in: fb2aca7823 user: matt tags: v2.0001-ulex-one-shot | |
Changes
Modified rmtmod.scm from [1808890632] to [e048074e8b].
︙ | ︙ | |||
1640 1641 1642 1643 1644 1645 1646 | ;; (max-connections 2048) (debug:print 2 *default-log-port* "PID: "(current-process-id)". Attempting to start the server ...") (if (and *db-serv-info* (servdat-uconn *db-serv-info*)) (let* ((uconn (servdat-uconn *db-serv-info*))) (wait-and-close uconn)) (let* ((port (portlogger:open-run-close portlogger:find-port)) | | | 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 | ;; (max-connections 2048) (debug:print 2 *default-log-port* "PID: "(current-process-id)". Attempting to start the server ...") (if (and *db-serv-info* (servdat-uconn *db-serv-info*)) (let* ((uconn (servdat-uconn *db-serv-info*))) (wait-and-close uconn)) (let* ((port (portlogger:open-run-close portlogger:find-port)) (handler-proc (lambda (rem-host-port cmd params) ;; (set! *db-last-access* (current-seconds)) (assert (list? params) "FATAL: handler called with non-list params") (assert (args:get-arg "-server") "FATAL: handler called on non-server side. cmd="cmd", params="params) (debug:print 0 *default-log-port* "handler call: "cmd", params="params) (api:execute-requests *dbstruct-db* cmd params)))) ;; (api:process-request *dbstuct-db* (if (not *db-serv-info*) |
︙ | ︙ |
Modified ulex-simple/ulex.scm from [47a35a69e2] to [7f69edd7ee].
︙ | ︙ | |||
102 103 104 105 106 107 108 | ;; threads (numthreads 50) (cmd-thread #f) (work-queue-thread #f) (num-threads-running 0) ) | < < < < < < < < < < < < < < < < | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | ;; threads (numthreads 50) (cmd-thread #f) (work-queue-thread #f) (num-threads-running 0) ) ;;====================================================================== ;; listener ;;====================================================================== ;; is uconn a ulex connector (listener) ;; (define (ulex-listener? uconn) |
︙ | ︙ | |||
196 197 198 199 200 201 202 | ;; retval tells send to expect and wait for return data (one line) and return it or time out ;; this is for ping where we don't want to necessarily have set up our own server yet. ;; ;; NOTE: see below for beginnings of code to allow re-use of tcp connections ;; - I believe (without substantial evidence) that re-using connections will ;; be beneficial ... ;; | | | | < < < < < < | | 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 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | ;; retval tells send to expect and wait for return data (one line) and return it or time out ;; this is for ping where we don't want to necessarily have set up our own server yet. ;; ;; NOTE: see below for beginnings of code to allow re-use of tcp connections ;; - I believe (without substantial evidence) that re-using connections will ;; be beneficial ... ;; (define (send-receive udata host-port cmd params) (mutex-lock! *send-mutex*) (let* ((my-host-port (udat-host-port udata)) ;; remote will return to this (isme (equal? host-port my-host-port)) ;; calling myself? ;; dat is a self-contained work block that can be sent or handled locally (dat (list my-host-port cmd params)) (parts (string-split host-port ":")) (host (car parts)) (port (string->number (cadr parts)))) (if isme (ulex-handler udata dat) ;; no transmission needed (let-values (((inp oup)(tcp-connect host-port))) (let ((res (if (and inp oup) (begin (serialize dat oup) (deserialize inp)) ;; yes, we always want an ack (begin (print "ERROR: send called but no receiver has been setup. Please call setup first!") #f)))) (close-input-port inp) (close-output-port oup) (mutex-unlock! *send-mutex*) res))))) ;;====================================================================== ;; responder side ;;====================================================================== ;; take a request, rdat, and if not immediate put it in the work queue ;; ;; Reserved cmds; ack ping goodbye response ;; (define (ulex-handler uconn rdat) (assert (list? rdat) "FATAL: ulex-handler give rdat as not list") (match rdat ((rem-host-port cmd params) (do-work uconn rdat)) (else (print "BAD DATA? controldat=" rdat) 'bad-data) )) ;; given an already set up uconn start the cmd-loop |
︙ | ︙ | |||
301 302 303 304 305 306 307 | #;(queue-add! (udat-work-queue uconn) rdat) (mailbox-send! (udat-work-queue uconn) rdat)) (define (do-work uconn rdat) (let* ((proc (udat-work-proc uconn))) ;; get it each time - conceivebly it could change ;; put this following into a do-work procedure (match rdat | | | | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | #;(queue-add! (udat-work-queue uconn) rdat) (mailbox-send! (udat-work-queue uconn) rdat)) (define (do-work uconn rdat) (let* ((proc (udat-work-proc uconn))) ;; get it each time - conceivebly it could change ;; put this following into a do-work procedure (match rdat ((rem-host-port cmd params) (let* ((start-time (current-milliseconds)) (result (proc rem-host-port cmd params)) (end-time (current-milliseconds)) (run-time (- end-time start-time))) result)) (else (print "ERROR: rdat "rdat", did not match rem-host-port qrykey cmd params") #f)))) |
︙ | ︙ |