Index: tcp-transportmod.scm ================================================================== --- tcp-transportmod.scm +++ tcp-transportmod.scm @@ -304,14 +304,15 @@ ;; ;; This is the routine called in megatest.scm to start a server ;; ;; Server viability is checked in keep-running. Blindly start and run here. ;; -(define (tt:start-server areapath run-id dbfname handler keys) +(define (tt:start-server areapath run-id dbfname-in handler keys) (assert areapath "FATAL: areapath not provided for tt:start-server") ;; is there already a server for this dbfile? Then exit. - (let* ((ttdat (make-tt areapath: areapath))) + (let* ((ttdat (make-tt areapath: areapath)) + (dbfname (or dbfname-in (dbmod:run-id->dbfname run-id)))) ;; (servers (tt:find-server areapath dbfname))) ;; should use tt:get-current-server-info instead ;; (if (null? servers) (let* ((dbstruct (dbmod:open-dbmoddb areapath run-id dbfname (dbfile:db-init-proc) keys))) (tt-handler-set! ttdat (handler dbstruct)) (let* ((tcp-thread (make-thread @@ -322,21 +323,10 @@ (lambda () (tt:keep-running ttdat dbfname dbstruct))))) (thread-start! tcp-thread) (thread-start! run-thread) (thread-join! run-thread) ;; run thread will exit on timeout or other conditions - ;; - ;; set a flag here to tell tcp-thread to stop running - ;; - ;; (thread-join! tcp-thread) ;; can't wait - ;; - ;; remove the servinfo file - ;; - ;; close the database, remove lock in on-disk db - ;; - ;; close the listener ports - ;; (exit))) ;;(begin ;; (debug:print 0 *default-log-port* "INFO: found server(s) already running for db "dbfname", "(string-intersperse servers ",")" Exiting.") ;; (exit))))) )) @@ -358,14 +348,16 @@ (let* ((last-update (dbr:dbstruct-last-update dbstruct)) (curr-secs (current-seconds))) (if (> (- curr-secs last-update) 3) ;; every 3-4 seconds update the db? maybe this should be refresh the inmem? (begin ((dbr:dbstruct-sync-proc dbstruct) last-update) - (dbr:dbstruct-last-update-set! curr-secs))) + (dbr:dbstruct-last-update-set! dbstruct curr-secs))) (thread-sleep! 0.25) (loop (+ count 1)))))) - + ;; load or reload the data into inmem db before + ;; ((dbr:dbstruct-sync-proc dbstruct) (dbr:dbstruct-last-update dbstruct)) + ;; (dbr:dbstruct-last-update-set! dbstruct (- (current-seconds) 1)) (tt:create-server-registration-file ttdat dbfname) ;; now start watching the last-access, if it hasn't been touched ;; in over ten seconds we exit (thread-sleep! 0.05) ;; any real need for delay here? (let loop ()