@@ -483,26 +483,38 @@ (lambda () (tt:keep-running ttdat dbfname dbstruct))))) (thread-start! tcp-thread) (thread-start! run-thread) - (procinf-port-set! *procinf* (tt-port ttdat)) (let* ((areapath (tt-areapath ttdat)) (nosyncdbpath (conc areapath"/.mtdb"))) + ;; this didn't seem to work, is port not available yet? + (let loop ((count 0)) + (if (tt-port ttdat) + (begin + (procinf-port-set! *procinf* (tt-port ttdat)) + (procinf-dbname-set! *procinf* dbfname) + (dbfile:with-no-sync-db + nosyncdbpath + (lambda (nsdb) + (dbfile:insert-or-update-process nsdb *procinf*)))) + (if (< count 5) + (begin + (thread-sleep! 0.5) + (loop (+ count 1))) + (debug:print 0 *default-log-port* "ERROR: (tt-port ttdat) no port set!")))) + + (thread-join! run-thread) ;; run thread will exit on timeout or other conditions + ;; replace with call to (dbfile:set-process-done nsdb host pid reason) + (procinf-status-set! *procinf* "done") + (procinf-end-set! *procinf* (current-seconds)) (dbfile:with-no-sync-db nosyncdbpath (lambda (nsdb) (dbfile:insert-or-update-process nsdb *procinf*))) - - (thread-join! run-thread) ;; run thread will exit on timeout or other conditions - (procinf-status-set! *procinf* "done") - (dbfile:with-no-sync-db - nosyncdbpath - (lambda (nsdb) - (dbfile:insert-or-update-process nsdb *procinf*)))) - (debug:print 0 *default-log-port* "Exiting now.") - (exit)))))) + (debug:print 0 *default-log-port* "Exiting now.") + (exit))))))) (define (tt:keep-running ttdat dbfname dbstruct) ;; verfiy conn for ready ;; listener socket has been started by this stage ;; wait for a port before creating the registration file