Index: ulex-simple/dbmgr.scm ================================================================== --- ulex-simple/dbmgr.scm +++ ulex-simple/dbmgr.scm @@ -630,17 +630,30 @@ ;;====================================================================== ;; END NEW SERVER METHOD ;;====================================================================== +;; sdat must be defined and the host and port set and the same as previous +;; +(define (host-port-is-stable? sdat old-host old-port) + (and sdat + (let ((new-host (servdat-host sdat)) + (new-port (servdat-port sdat))) + (and new-host + new-port + (equal? new-host old-host) + (equal? new-port old-port))))) + ;; if .db/main.db check the pkts ;; (define (rmt:wait-for-server pkts-dir db-file server-key) (let* ((sdat *db-serv-info*)) (let loop ((start-time (current-seconds)) (changed #t) - (last-sdat "not this")) + (last-sdat "not this") + (last-host #f) + (last-port #f)) (begin ;; let ((sdat #f)) (thread-sleep! 0.01) (debug:print-info 0 *default-log-port* "Waiting for server alive signature") (mutex-lock! *heartbeat-mutex*) (set! sdat *db-serv-info*) @@ -700,18 +713,20 @@ (thread-sleep! 0.2) (exit))) sdat)) (begin ;; sdat not yet contains server info (debug:print-info 0 *default-log-port* "Still waiting, last-sdat=" last-sdat) - (thread-sleep! 4) + (thread-sleep! 0.1) (if (> (- (current-seconds) start-time) 120) ;; been waiting for two minutes (begin (debug:print-error 0 *default-log-port* "transport appears to have died, exiting server") (exit)) (loop start-time - (equal? sdat last-sdat) - sdat)))))))) + (not (host-port-is-stable? sdat last-host last-port)) + sdat + (servdat-host sdat) + (servdat-port sdat))))))))) (define (rmt:register-server sinfo apath iface port server-key dbname) (servdat-conns sinfo) ;; just checking types (rmt:open-main-connection sinfo apath) ;; we need a channel to main.db (rmt:send-receive sinfo apath ;; params: host port servkey pid ipaddr dbpath