Index: apimod.scm ================================================================== --- apimod.scm +++ apimod.scm @@ -374,11 +374,11 @@ ((general-call) (let ((stmtname (car params)) (run-id (cadr params)) (realparams (cddr params))) (db:general-call dbstruct stmtname run-id realparams))) ((sdb-qry) (apply sdb:qry params)) - ((ping) `(#t ,(current-process-id) (cadr params))) ;; (current-process-id)) + ((ping) `(#t ,(current-process-id) ,(cadr params))) ;; (current-process-id)) ((get-changed-record-ids) (apply db:get-changed-record-ids dbstruct params)) ((get-run-record-ids) (apply db:get-run-record-ids dbstruct params)) ;; TESTMETA ((testmeta-get-record) (apply db:testmeta-get-record dbstruct params)) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -1067,15 +1067,17 @@ (else (pp data)))))) (if out-file (close-output-port out-port)) (exit) ;; yes, bending the rules here - need to exit since this is a utility )) - - (if (args:get-arg "-ping") + + ;; disabled for now + + #;(if (args:get-arg "-ping") (let* ((server-id (string->number (args:get-arg "-ping"))) ;; extract run-id (i.e. no ":" (host:port (args:get-arg "-ping"))) - (server:ping (or server-id host:port) #f do-exit: #t))) + (server-ready? (or server-id host:port) #f do-exit: #t))) ;;====================================================================== ;; Capture, save and manipulate environments ;;====================================================================== Index: rmtmod.scm ================================================================== --- rmtmod.scm +++ rmtmod.scm @@ -359,15 +359,15 @@ ;; (define (rmt:send-receive-real sinfo apath dbname cmd params) (let* ((cdat (rmt:get-conn sinfo apath dbname))) (assert cdat "FATAL: rmt:send-receive-real called without the needed channels opened") (let* ((key #f) - (payload `((cmd . ,cmd) - (key . ,(conndat-srvkey cdat)) - (params . ,params))) + #;(payload `(,cmd ;; (cmd . ,cmd)(key . + ,(conndat-srvkey cdat) + ,params)) (uconn (servdat-uconn sinfo)) - (res (send-receive uconn (conndat-hostport cdat) cmd payload))) + (res (send-receive uconn (conndat-hostport cdat) cmd params))) ;; payload))) (if (member res '("#")) ;; TODO - fix this in string->sexpr #f res)))) ;; db is at apath/.db/dbname, rid is an intermediary solution and will be removed @@ -1614,11 +1614,11 @@ ;; NOTE: This is NOT called directly from clients as not all transports support a client running ;; in the same process as the server. ;; ;; conn is a conndat record ;; -(define (server:ping uconn #!key (do-exit #f)) +#;(define (server:ping uconn #!key (do-exit #f)) (let* ((srvkey (conndat-srvkey uconn)) (msg (sexpr->string '(ping ,srvkey)))) (send-receive uconn 'ping msg))) ;; (server-ready? host port server-id)) ;;====================================================================== @@ -1647,12 +1647,14 @@ (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 qrykey cmd params) ;; - (let* ((prms (alist-ref 'params params))) - (api:execute-requests *dbstruct-db* cmd prms #;params))))) + ;;(let* ((prms (alist-ref 'params params))) + ;; (api:execute-requests *dbstruct-db* cmd prms))))) + (assert (list? params) "FATAL: handler called with non-list params") + (api:execute-requests *dbstruct-db* cmd params)))) ;; (api:process-request *dbstuct-db* (if (not *db-serv-info*) (set! *db-serv-info* (make-servdat host: hostn port: port))) (let* ((uconn (run-listener handler-proc port)) (rport (udat-port uconn))) ;; the real port @@ -1791,13 +1793,14 @@ (define (server-address srv-pkt) (conc (alist-ref 'host srv-pkt) ":" (alist-ref 'port srv-pkt))) (define (server-ready? uconn host-port key) ;; server-address is host:port - (let* ((data (sexpr->string `((cmd . ping) - (key . ,key) - (params . ())))) + (let* ((params `((cmd . ping)(key . ,key))) + (data `((cmd . ping) + (key . ,key) + (params . ,params))) ;; I don't get it. (res (send-receive uconn host-port 'ping data))) (if res (car res) res))) Index: ulex/ulex.scm ================================================================== --- ulex/ulex.scm +++ ulex/ulex.scm @@ -150,11 +150,11 @@ uconn)) ;; run-listener does all the work of starting a listener in a thread ;; it then returns control ;; -(define (run-listener handler-proc #!optional (port-suggestion #f)) +(define (run-listener handler-proc #!optional (port-suggestion 4242)) (let* ((uconn (make-udat))) (udat-work-proc-set! uconn handler-proc) (if (setup-listener uconn port-suggestion) (let* ((th1 (make-thread (lambda ()(ulex-cmd-loop uconn)) "Ulex command loop")) (th2 (make-thread (lambda ()(process-work-queue uconn)) "Ulex work queue processor"))) @@ -235,10 +235,11 @@ ;; 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 ;; (string-split controldat) ((rem-host-port qrykey cmd params) ;; (print "ulex-handler got: "rem-host-port" qrykey: "qrykey" cmd: "cmd" params: "params) (let ((mbox (hash-table-ref/default (udat-mboxes uconn) qrykey #f))) (case cmd