Index: megamod.scm ================================================================== --- megamod.scm +++ megamod.scm @@ -48,14 +48,36 @@ (module rmtmod * (import scheme chicken data-structures extras) -(import (prefix sqlite3 sqlite3:) posix typed-records srfi-18 srfi-69 format ports srfi-1 matchable - s11n stml2 srfi-13 stack regex irregex z3 - call-with-environment-variables - csv) +(import + (prefix sqlite3 sqlite3:) + call-with-environment-variables + csv + format + http-client + intarweb + irregex + matchable + ports + posix + regex + s11n + spiffy + spiffy-directory-listing + spiffy-request-vars + srfi-1 + srfi-13 + srfi-18 + srfi-69 + stack + stml2 + typed-records + uri-common + z3 + ) ;; (import apimod) (import archivemod) (import clientmod) (import commonmod) @@ -88,11 +110,11 @@ (include "run_records.scm") ;;====================================================================== ;; L O C K I N G M E C H A N I S M S ;;====================================================================== -;; (include "f2.scm") +(include "f2.scm") ;; General data ;; (define (dcommon:general-info) (let ((general-matrix (iup:matrix @@ -2300,36 +2322,36 @@ ;; ((exn http client-error) e (print e))) (set! res (vector ;;; DON'T FORGET - THIS IS THE CLIENT SIDE! NOTE: consider moving this to client.scm since we are only supporting http transport at this time. success (db:string->obj (handle-exceptions - exn - (let ((call-chain (get-call-chain)) - (msg ((condition-property-accessor 'exn 'message) exn))) - (set! success #f) - (if (debug:debug-mode 1) - (debug:print-info 0 *default-log-port* "couldn't talk to server, trying again ...") - (begin - (debug:print 0 *default-log-port* "WARNING: failure in with-input-from-request to " fullurl ".") - (debug:print 0 *default-log-port* " message: " msg) - (debug:print 0 *default-log-port* " cmd: " cmd " params: " params) - (debug:print 0 *default-log-port* " call-chain: " call-chain))) - (if areadat - (areadat-conndat-set! areadat #f)) - ;; Killing associated server to allow clean retry.") - ;; (tasks:kill-server-run-id run-id) ;; better to kill the server in the logic that called this routine? - (mutex-unlock! *http-mutex*) + exn + (let ((call-chain (get-call-chain)) + (msg ((condition-property-accessor 'exn 'message) exn))) + (set! success #f) + (if (debug:debug-mode 1) + (debug:print-info 0 *default-log-port* "couldn't talk to server, trying again ...") + (begin + (debug:print 0 *default-log-port* "WARNING: failure in with-input-from-request to " fullurl ".") + (debug:print 0 *default-log-port* " message: " msg) + (debug:print 0 *default-log-port* " cmd: " cmd " params: " params) + (debug:print 0 *default-log-port* " call-chain: " call-chain))) + (if areadat + (areadat-conndat-set! areadat #f)) + ;; Killing associated server to allow clean retry.") + ;; (tasks:kill-server-run-id run-id) ;; better to kill the server in the logic that called this routine? + (mutex-unlock! *http-mutex*) ;;; (signal (make-composite-condition ;;; (make-property-condition 'commfail 'message "failed to connect to server"))) ;;; "communications failed" - (db:obj->string #f)) - (with-input-from-request ;; was dat - fullurl - (list (cons 'key (or *server-id* "thekey")) - (cons 'cmd cmd) - (cons 'params sparams)) - read-string)) + (db:obj->string #f)) ;; end of the error handling part + (with-input-from-request ;; was dat + fullurl + (list (cons 'key (or *server-id* "thekey")) + (cons 'cmd cmd) + (cons 'params sparams)) + read-string)) transport: 'http) 0)) ;; added this speculatively ;; Shouldn't this be a call to the managed call-all-connections stuff above? (close-all-connections!) (mutex-unlock! *http-mutex*) @@ -2348,11 +2370,11 @@ (if (vector-ref res 0) ;; this is the first flag or the second flag? res ;; this is the *inner* vector? seriously? why? (if (debug:debug-mode 11) (let ((call-chain (get-call-chain))) ;; note: this code also called in nmsg-transport - consider consolidating it (print-call-chain (current-error-port)) - (debug:print-error 11 *default-log-port* "error above occured at server, res=" res " message: " ((condition-property-accessor 'exn 'message) exn)) + (debug:print-error 11 *default-log-port* "error above occured at server, res=" res) ;; there is NO exn at this time " message: " ((condition-property-accessor 'exn 'message) exn)) (debug:print 11 *default-log-port* " server call chain:") (pp (vector-ref res 1) (current-error-port)) (signal (vector-ref res 0))) res)) (signal (make-composite-condition @@ -2380,7 +2402,7 @@ #f))) ;; http-transport:server-dat definition moved to common_records.scm ;; bunch of small functions factored out of send-receive to make debug easier ;; -;; (include "f1.scm") +(include "f1.scm") )