Index: tcp-transportmod.scm ================================================================== --- tcp-transportmod.scm +++ tcp-transportmod.scm @@ -154,15 +154,16 @@ dbfname: dbfname servinf-file: servinffile server-id: server-id server-start: start-time pid: pid))) - (hash-table-set! (tt-conns ttdat) dbfname conn) ;; verify we can talk to this server (let* ((ping-res (tt:ping host port server-id))) (case ping-res - ((running) conn) + ((running) + (hash-table-set! (tt-conns ttdat) dbfname conn) ;;; is this ok to save before validating that the connection is good? + conn) ((starting) (thread-sleep! 0.5) (tt:client-connect-to-server ttdat dbfname run-id testsuite)) (else (let* ((curr-secs (current-seconds))) @@ -171,13 +172,12 @@ (begin (tt-last-serv-start-set! ttdat curr-secs) (server-start-proc))) ;; start server if 30 sec since last attempt (thread-sleep! 1) (tt:client-connect-to-server ttdat dbfname run-id testsuite))))))) - - (else - (if (> (- (current-seconds) (tt-last-serv-start ttdat)) 5) ;; really do not want to swamp the machine with servers + (else ;; no good server found, if haven't started server in > 5 secs, start another + (if (> (- (current-seconds) (tt-last-serv-start ttdat)) 5) ;; BUG - grow this number really do not want to swamp the machine with servers (begin (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) @@ -744,13 +744,13 @@ ;; find a port and start tcp-server. This only starts the tcp portion of ;; the server, look at (tt:start-server ...) above for the entry point ;; for the entire server system ;; (define (tt:start-tcp-server ttdat) - (setup-listener-portlogger ttdat) + (setup-listener-portlogger ttdat) ;; set up tcp-listener (let* ((socket (tt-socket ttdat)) - (handler (tt-handler ttdat)) + (handler (tt-handler ttdat)) ;; the handler comes from our client setting a handler function (handler-proc (lambda () (let* ((indat (deserialize)) (result #f) (exn-result #f) (stdout-result (with-output-to-string @@ -764,11 +764,12 @@ ;; these are always bad, set up an exit thread (thread-start! (make-thread (lambda () (thread-sleep! 5) (exit)))) #f) - (handler indat)))) + (handler indat) ;; this is the proc being called by the remote client + ))) (set! result res))))) (full-result (list result exn-result (if (equal? stdout-result "") #f stdout-result)))) (handle-exceptions exn (begin @@ -785,20 +786,20 @@ ;; return #f if fail to find a port to allocate. ;; ;; if udata-in is #f create the record ;; if there is already a serv-listener return the udata ;; -(define (setup-listener uconn #!optional (port 4242)) - (assert (tt? uconn) "FATAL: setup-listener called with wrong struct "uconn) - (handle-exceptions - exn - (if (< port 65535) - (begin - (thread-sleep! 0.25) - (setup-listener uconn (+ port 1))) - #f) - (connect-listener uconn port))) +;; (define (setup-listener uconn #!optional (port 4242)) +;; (assert (tt? uconn) "FATAL: setup-listener called with wrong struct "uconn) +;; (handle-exceptions +;; exn +;; (if (< port 65535) +;; (begin +;; (thread-sleep! 0.25) +;; (setup-listener uconn (+ port 1))) +;; #f) +;; (connect-listener uconn port))) (define (setup-listener-portlogger uconn) (let ((port (portlogger:open-run-close portlogger:find-port))) (assert (tt? uconn) "FATAL: setup-listener called with wrong struct "uconn) (handle-exceptions Index: utils/plot-code.scm ================================================================== --- utils/plot-code.scm +++ utils/plot-code.scm @@ -23,21 +23,41 @@ ;; dot -Tpdf plot.dot > plot.pdf ;; first param is comma separated list of files to include in the map, use - to do all ;; second param is list of regexs for functions to include in the map ;; third param is list of files to scan -(use regex srfi-69 srfi-13) +;; (use regex srfi-69 srfi-1 srfi-13) + +(module plot-code + * + +(import scheme chicken.base chicken.port chicken.string chicken.io) +(import chicken.process-context) +(import regex srfi-1 srfi-69 srfi-13 matchable) +(define files #f) +(define targs #f) +(define function-patt #f) (define targs #f) -(define files (cdr (cddddr (argv)))) - -(let ((targdat (cadddr (argv)))) - (if (equal? targdat "-") - (set! targs files) - (set! targs (string-split targdat ",")))) - -(define function-patt (car (cdr (cdddr (argv))))) + +(match (command-line-arguments) + ((targfiles fnrx . scanfiles) + (set! targs (string-split-fields "," targfiles #:infix)) + (set! function-patt fnrx) + (set! files scanfiles)) + (else + (print "Usage: plot-code file1.scm,file2.scm *.scm > plot.dot + dot -Tpdf plot.dot > plot.pdf") + (exit))) + +;; (define files (cdr (cddddr (argv)))) +;; +;; (let ((targdat (cadddr (argv)))) +;; (if (equal? targdat "-") +;; (set! targs files) +;; (set! targs (string-split targdat ",")))) + (define function-rx (regexp function-patt)) (define filedat-defns (make-hash-table)) (define filedat-usages (make-hash-table)) (define defn-rx (regexp "^\\s*\\(define\\s+\\(([^\\s\\)]+).*")) @@ -197,5 +217,6 @@ function-calls) (print "}") (exit) +)