34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
(conndat #f)
(transport *transport-type*)
(server-timeout (or (server:get-timeout) 100))) ;; default to 100 seconds
;;======================================================================
;; S U P P O R T F U N C T I O N S
;;======================================================================
;; thread-safe interface to *runremote* hash
(define *rrr-mutex* (make-mutex))
(define (rmt:get-cinfo rid)
(mutex-lock! *rrr-mutex*)
(let* ((run-id (if rid rid 0))
(cinfo (hash-table-ref/default *runremote* run-id #f)))
(mutex-unlock! *rrr-mutex*)
cinfo))
(define (rmt:set-cinfo rid server-dat)
(mutex-lock! *rrr-mutex*)
(let* ((run-id (if rid rid 0))
(res (hash-table-set! *runremote* run-id server-dat)))
(mutex-unlock! *rrr-mutex*)
res))
(define (rmt:del-cinfo rid)
(mutex-lock! *rrr-mutex*)
(let* ((run-id (if rid rid 0))
(res (hash-table-delete! *runremote* run-id)))
(mutex-unlock! *rrr-mutex*)
res))
;; if a server is either running or in the process of starting call client:setup
;; else return #f to let the calling proc know that there is no server available
;;
(define (rmt:get-connection-info run-id)
(let ((cinfo (remote-conndat *runremote*)))
(if cinfo
|