Index: http-transport.scm ================================================================== --- http-transport.scm +++ http-transport.scm @@ -162,10 +162,12 @@ ;;====================================================================== ;; C L I E N T S ;;====================================================================== +(define *http-mutex* (make-mutex)) + ;; ;; ;; 1 Hello, world! Goodbye Dolly ;; Send msg to serverdat and receive result (define (http-transport:client-send-receive serverdat msg) @@ -172,12 +174,14 @@ (let* ((url (http-transport:make-server-url serverdat)) (fullurl (conc url "/ctrl")) ;; (conc url "/?dat=" msg))) (numretries 0)) (handle-exceptions exn - (if (< numretries 200) - (http-transport:client-send-receive serverdat msg)) + (begin + (debug:print 0 "WARNING: possible communication error") + (if (< numretries 200) + (http-transport:client-send-receive serverdat msg))) (begin (debug:print-info 11 "fullurl=" fullurl "\n") ;; set up the http-client here (max-retry-attempts 100) (retry-request? (lambda (request) @@ -185,15 +189,18 @@ (set! numretries (+ numretries 1)) #t)) ;; send the data and get the response ;; extract the needed info from the http data and ;; process and return it. + (mutex-lock! *http-mutex*) (let* ((res (with-input-from-request fullurl ;; #f ;; msg (list (cons 'dat msg)) read-string))) + (close-all-connections!) + (mutex-unlock! *http-mutex*) (debug:print-info 11 "got res=" res) (let ((match (string-search (regexp "(.*)<.body>") res))) (debug:print-info 11 "match=" match) (let ((final (cadr match))) (debug:print-info 11 "final=" final)