Index: apimod.scm ================================================================== --- apimod.scm +++ apimod.scm @@ -405,11 +405,11 @@ (debug:print 4 *default-log-port* "server-id:" *server-id*) (let* ((cmd ($ 'cmd)) (paramsj ($ 'params)) (key ($ 'key)) (params (db:string->obj paramsj transport: 'http))) ;; incoming data from the POST (or is it a GET?) - (debug:print 4 *default-log-port* "cmd:" cmd " with params " params "key " key) + (debug:print 0 *default-log-port* "cmd:" cmd " with params " params "key " key) (if (equal? key *server-id*) (begin (set! *api-process-request-count* (+ *api-process-request-count* 1)) (let* ((resdat (api:execute-requests dbstruct (vector cmd params))) ;; process the request, resdat = #( flag result ) (success (vector-ref resdat 0)) @@ -430,8 +430,7 @@ ;; (list "ERROR, not string, list, number or boolean" 1 cmd params res))))) (db:obj->string res transport: 'http))) (begin (debug:print 0 *default-log-port* "Server refused to process request. Sever id mismatch. recived " key " expected: " *server-id* ".\nOther arguments recived: cmd=" cmd " params = " params) (db:obj->string (conc "Server refused to process request server-id mismatch: " key ", " *server-id*) transport: 'http))))) - ) Index: http-transportmod.scm ================================================================== --- http-transportmod.scm +++ http-transportmod.scm @@ -315,14 +315,14 @@ (vector #t ;; success (with-input-from-request (servdat-api-uri sdat) (list (cons 'key qry-key) - (cons 'srvid (servdat-uuid sdat)) + ;; (cons 'srvid (servdat-uuid sdat)) (cons 'cmd cmd) (cons 'params sparams)) - read))))) + read-string))))) ;; or read-string? (time-out (lambda () (thread-sleep! 45) (debug:print 0 *default-log-port* "WARNING: send-receive took more than 45 seconds!!") #f)) (th1 (make-thread send-recieve "with-input-from-request")) @@ -391,11 +391,11 @@ (let* ((sdat (or sdat-in (make-servdat)))) (if uuid (servdat-uuid-set! sdat uuid)) (servdat-host-set! sdat iface) (servdat-port-set! sdat port) (servdat-api-url-set! sdat (conc "http://" iface ":" port "/api")) - (servdat-api-uri-set! sdat (uri-reference (servdat->url sdat))) + (servdat-api-uri-set! sdat (uri-reference (servdat-api-url sdat))) (servdat-api-req-set! sdat (make-request method: 'POST uri: (servdat-api-uri sdat))) ;; set up the http-client parameters (max-retry-attempts 1) ;; consider all requests indempotent Index: rmtmod.scm ================================================================== --- rmtmod.scm +++ rmtmod.scm @@ -162,10 +162,13 @@ (lastmsg 0) (expires 0)) ;; replaces *runremote* (define *rmt:remote* (make-rmt:remote)) + +;; set up the api proc, seems like there should be a better place for this? +(api-proc api:process-request) ;; do we have a connection to apath dbname and ;; is it not expired? then return it ;; ;; else setup a connection @@ -200,11 +203,13 @@ (thread-sleep! 1.5) (rmt:open-main-connection remote apath) ;; TODO: Add limit to number of tries ))) (if the-srv ;; yes, we have a server, now try connecting to it (let* ((srv-addr (server-address the-srv)) - (srvready (server-ready? srv-addr)) + (ipaddr (alist-ref 'ipaddr the-srv)) + (port (alist-ref 'port the-srv)) + (srvready (server-ready? ipaddr port)) (fullpath (db:dbname->path apath dbname))) (if srvready (hash-table-set! (rmt:remote-conns remote) fullpath (make-rmt:conn