Index: tcp-transportmod.scm ================================================================== --- tcp-transportmod.scm +++ tcp-transportmod.scm @@ -159,12 +159,14 @@ servinf-file: servinffile server-id: server-id server-start: start-time pid: pid))) ;; verify we can talk to this server - (let* ((ping-res (tt:ping host port server-id))) - ; (debug:print-info 0 *default-log-port* "ping-res:" ping-res) + (let* ((result (tt:timed-ping host port server-id)) + (ping-res (car result)) + (ping (cdr result))) + (debug:print-info 0 *default-log-port* "ping time:" ping) (case ping-res ((running) (hash-table-set! (tt-conns ttdat) dbfname conn) ;;; is this ok to save before validating that the connection is good? conn) ((starting) @@ -185,10 +187,16 @@ (debug:print-info 0 *default-log-port* "No server found. Starting one for run-id "run-id" in dbfile "dbfname) (server-start-proc) (tt-last-serv-start-set! ttdat (current-seconds)))) (thread-sleep! 1) (tt:client-connect-to-server ttdat dbfname run-id testsuite))))))) + +(define (tt:timed-ping host port server-id) + (let* ((start-time (current-milliseconds)) + (result (tt:ping host port server-id))) + (cons result (- (current-milliseconds) start-time)))) + (define (tt:ping host port server-id #!optional (tries-left 5)) (let* ((res (tt:send-receive-direct host port `(ping #f #f #f) ping-mode: #t)) ;; please send me your server-id (try-again (lambda () (if (> tries-left 0) @@ -544,11 +552,13 @@ (else (debug:print-info 0 *default-log-port* "I'm not the lead server: "servers) (let* ((leadsrv (car servers))) (match leadsrv ((host port startseconds server-id pid dbfname servinfofile) - (let* ((res (tt:ping host port server-id))) + (let* ((result (tt:timed-ping host port server-id)) + (res (car result)) + (ping (cdr result))) (debug:print-info 0 *default-log-port* "Ping to "host":"port", with server-id "server-id ", and file "servinfofile" returned "res) (if res #f ;; not the server, but all good, want to exit (if (and (file-exists? servinfofile)