Index: rmtmod.scm ================================================================== --- rmtmod.scm +++ rmtmod.scm @@ -2225,12 +2225,11 @@ ;; this is our forever loop (let* ((iface (servdat-host *server-info*)) (port (servdat-port *server-info*))) (let loop ((count 0) (bad-sync-count 0) - (start-time (current-milliseconds))) - + (start-time (current-process-milliseconds))) (if (and (not is-main) (common:low-noise-print 60 "servdat-status")) (debug:print-info 0 *default-log-port* "servdat-status is " (servdat-status *server-info*))) ;; set up the database handle @@ -2283,18 +2282,18 @@ (mutex-unlock! *heartbeat-mutex*) ;; when things go wrong we don't want to be doing the various ;; queries too often so we strive to run this stuff only every ;; four seconds or so. - (let* ((sync-time (- (current-milliseconds) start-time)) + (let* ((sync-time (- (current-process-milliseconds) start-time)) (rem-time (quotient (- 4000 sync-time) 1000))) (if (and (<= rem-time 4) (> rem-time 0)) (thread-sleep! rem-time))) (if (< count 1) ;; 3x3 = 9 secs aprox - (loop (+ count 1) bad-sync-count (current-milliseconds))) + (loop (+ count 1) bad-sync-count (current-process-milliseconds))) ;; Transfer *db-last-access* to last-access to use in checking that we are still alive (set! last-access *db-last-access*) (if (common:low-noise-print 60 "dbstats") @@ -2308,17 +2307,17 @@ (shutdown-server-sequence port)) ((timed-out?) (debug:print-info 0 *default-log-port* "Server timed out. seconds since last db access: " (- (current-seconds) last-access)) (shutdown-server-sequence port)) ((and *server-run* - (not (timed-out?)) - #;(if is-main ;; intention here was to exit main server quickly. - (> (rmt:get-count-servers remdat *toppath*) 1) - #t)) + (or (not (timed-out?)) + (if is-main ;; do not exit if there are other servers (keep main open until all others gone) + (> (rmt:get-count-servers remdat *toppath*) 1) + #f))) (if (common:low-noise-print 120 "server continuing") (debug:print-info 0 *default-log-port* "Server continuing, seconds since last db access: " (- (current-seconds) last-access))) - (loop 0 bad-sync-count (current-milliseconds))) + (loop 0 bad-sync-count (current-process-milliseconds))) (else (set! *unclean-shutdown* #f) (debug:print-info 0 *default-log-port* "Server timed out. seconds since last db access: " (- (current-seconds) last-access)) (shutdown-server-sequence port) #;(debug:print-info 0 *default-log-port* "Sending 'quit to server, received: "