Index: tcp-transportmod.scm ================================================================== --- tcp-transportmod.scm +++ tcp-transportmod.scm @@ -93,14 +93,13 @@ ) (define (tt:make-remote areapath) (make-tt area: areapath)) -;; -;; DUPLICATED WITH tt:handler (I think) -;; - +;; do all the busy work of finding and setting up conn for +;; connecting to a server +;; (define (tt:client-connect-to-server ttdat dbfname run-id) (let* ((conn (hash-table-ref/default (tt-conns ttdat) dbfname #f))) (if conn conn ;; we are already connected to the server (let* ((sdat (tt:get-current-server-info ttdat dbfname run-id))) @@ -124,35 +123,39 @@ (thread-sleep! 1) (tt:client-connect-to-server ttdat dbfname run-id))))))) ;; client side handler ;; -(define (tt:handler runremote cmd rid params attemptnum area-dat areapath readonly-mode dbfname testsuite mtexe) +(define (tt:handler ttdat cmd run-id params attemptnum area-dat areapath readonly-mode dbfname testsuite mtexe) ;; NOTE: areapath is passed in and in tt struct. We'll use passed in value for now. - (let* ((conn (hash-table-ref/default (tt-conns runremote) dbfname #f))) + (let* ((conn (tt:client-connect-to-server ttdat dbfname run-id))) ;; (hash-table-ref/default (tt-conns ttdat) dbfname #f))) (if conn ;; have connection, call the server - (let* ((res (tt:send-receive runremote conn cmd rid params))) + (let* ((res (tt:send-receive ttdat conn cmd run-id params))) (cond ((member res '(busy starting)) (thread-sleep! 1) - (tt:handler runremote cmd rid params attemptnum area-dat areapath readonly-mode dbfname testsuite mtexe)) + (tt:handler ttdat cmd run-id params attemptnum area-dat areapath readonly-mode dbfname testsuite mtexe)) (else res))) + (begin + (thread-sleep! 1) ;; give it a rest and try again + (tt:handler ttdat cmd run-id params attemptnum area-dat areapath readonly-mode dbfname testsuite mtexe))))) + ;; no conn yet, find and or start and find a server - (let* ((server (tt:find-server runremote dbfname))) - (if server - (let* ((conn (tt:client-connect-to-server server))) - (hash-table-set! (tt-conns runremote) dbfname conn) - (tt:handler runremote cmd rid params attemptnum area-dat areapath readonly-mode - dbfname testsuite mtexe)) - ;; no server, try to start a server process - (begin - (tt:server-process-run areapath testsuite mtexe rid) ;; #!key (profile-mode "")) - (thread-sleep! 1) - (tt:handler runremote cmd rid params attemptnum area-dat areapath - readonly-mode dbfname testsuite mtexe))))))) +;; (let* ((server (tt:find-server ttdat dbfname))) +;; (if server +;; (let* ((conn (tt:client-connect-to-server server))) +;; (hash-table-set! (tt-conns ttdat) dbfname conn) +;; (tt:handler ttdat cmd run-id params attemptnum area-dat areapath readonly-mode +;; dbfname testsuite mtexe)) +;; ;; no server, try to start a server process +;; (begin +;; (tt:server-process-run areapath testsuite mtexe run-id) ;; #!key (profile-mode "")) +;; (thread-sleep! 1) +;; (tt:handler ttdat cmd run-id params attemptnum area-dat areapath +;; readonly-mode dbfname testsuite mtexe))))))) (define (tt:bid-for-servership run-id) #f) (define (tt:get-current-server-info ttdat dbfname run-id) @@ -352,11 +355,12 @@ (let* ((logfile (conc areapath "/logs/server.log")) ;; -" curr-pid "-" target-host ".log")) (cmdln (conc mtexe " -server - ";; (or target-host "-") " -m testsuite:" testsuite - " -run-id " run-id + " -run-id " (or run-id "main") + " -db " (dbmod:run-id->dbfname run-id) " " profile-mode ))) ;; (conc " >> " logfile " 2>&1 &"))))) ;; we want the remote server to start in *toppath* so push there (push-directory areapath) (debug:print 0 *default-log-port* "INFO: Trying to start server in tcp mode (" cmdln ") ...")