Overview
Comment: | wip |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.6584-ck5 |
Files: | files | file ages | folders |
SHA1: |
3c5e874d197d42dcd52de6cf29a57536 |
User & Date: | matt on 2021-05-02 23:50:04 |
Other Links: | branch diff | manifest | tags |
Context
2021-05-03
| ||
23:33 | wip check-in: 064cde8cf9 user: matt tags: v1.6584-ck5 | |
2021-05-02
| ||
23:50 | wip check-in: 3c5e874d19 user: matt tags: v1.6584-ck5 | |
22:49 | wip check-in: 621ec7fe98 user: matt tags: v1.6584-ck5 | |
Changes
Modified http-transportmod.scm from [904aac257a] to [dff08aec04].
︙ | ︙ | |||
468 469 470 471 472 473 474 | (conc (alist-ref 'host srv-pkt) ":" (alist-ref 'port srv-pkt))) (define (server-ready? host port) ;; server-address is host:port ;; ping the server and ask it ;; if it ready (let* ((sdat (servdat-init #f host port #f))) | | | | | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | (conc (alist-ref 'host srv-pkt) ":" (alist-ref 'port srv-pkt))) (define (server-ready? host port) ;; server-address is host:port ;; ping the server and ask it ;; if it ready (let* ((sdat (servdat-init #f host port #f))) (http-transport:send-receive sdat "abc" 'ping '()))) ;; from the pkts return servers associated with dbpath ;; NOTE: Only one can be alive - have to check on each ;; in the list of pkts returned ;; (define (get-viable-servers serv-pkts dbpath) (let loop ((tail serv-pkts) (res '())) (if (null? tail) res ;; NOTE: sort by age so oldest is considered first (let* ((spkt (car tail))) (loop (cdr tail) (if (equal? dbpath (alist-ref 'dbpath spkt)) (cons spkt res) res)))))) ;; from viable servers get one that is alive and ready ;; (define (get-the-server serv-pkts) (let loop ((tail serv-pkts)) (if (null? tail) #f (let* ((spkt (car tail)) (host (alist-ref 'ipaddr spkt)) (port (alist-ref 'port spkt)) (addr (server-address spkt))) (if (server-ready? host port) spkt (loop (cdr tail))))))) ;; am I the "first" in line server? I.e. my D card is smallest |
︙ | ︙ |
Modified rmtmod.scm from [659d29d212] to [f4d2b319a7].
︙ | ︙ | |||
176 177 178 179 180 181 182 | (let* ((fullname (db:dbname->path apath dbname)) (conn (hash-table-ref/default (rmt:remote-conns remote) fullname #f))) (if (and conn (> (current-seconds) (rmt:conn-expires conn))) conn #f))) | | > > | > > < < < < | > | > | 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 | (let* ((fullname (db:dbname->path apath dbname)) (conn (hash-table-ref/default (rmt:remote-conns remote) fullname #f))) (if (and conn (> (current-seconds) (rmt:conn-expires conn))) conn #f))) (define (rmt:find-main-server apath dbname) (let* ((pktsdir (get-pkts-dir apath)) (all-srvpkts (get-all-server-pkts pktsdir *srvpktspec*)) (dbpath (conc apath "/" dbname)) (viable-srvs (get-viable-servers all-srvpkts dbpath))) (get-the-server viable-srvs))) ;; looks for a connection to main ;; connections for other servers happens by requesting from main ;; (define (rmt:open-main-connection remote apath) (let* ((dbname (db:run-id->dbname #f)) (the-srv (rmt:find-main-server apath dbname)) (start-main-srv (lambda () ;; srv not ready, delay a little and try again (system (conc "nbfake megatest -server - -area "apath " -db "dbname)) (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)) (fullpath (db:dbname->path apath dbname))) |
︙ | ︙ |