125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
-
+
|
(else (exit))))
(success (if (vector? dat) (vector-ref dat 0) #f))
(res (if (vector? dat) (vector-ref dat 1) #f)))
(if (vector? connection-info)(http-transport:server-dat-update-last-access connection-info))
(if success
(begin
;; (mutex-unlock! *send-receive-mutex*)
(case
(case transport-type
((http) res) ;; (db:string->obj res))
((nmsg) res))) ;; (vector-ref res 1)))
(begin ;; let ((new-connection-info (client:setup run-id)))
(debug:print 0 "WARNING: Communication failed, trying call to rmt:send-receive again.")
;; (case *transport-type*
;; ((nmsg)(nn-close (http-transport:server-dat-get-socket connection-info))))
(common:del-remote! remote run-id) ;; don't keep using the same connection
|
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
-
+
-
+
|
(if (and faststart (equal? faststart "no"))
(begin
(tasks:start-and-wait-for-server (db:delay-if-busy (tasks:open-db area-dat)) run-id 10)
(thread-sleep! (random 5)) ;; give some time to settle and minimize collison?
(rmt:send-receive cmd rid params area-dat attemptnum: (+ attemptnum 1)))
(begin
(server:kind-run run-id area-dat)
(rmt:open-qry-close-locally cmd run-id area-dat params area-dat))))
(rmt:open-qry-close-locally cmd run-id area-dat params))))
(begin
;; (debug:print 0 "ERROR: Communication failed!")
;; (mutex-unlock! *send-receive-mutex*)
;; (exit)
(rmt:open-qry-close-locally cmd run-id area-dat params area-dat)
(rmt:open-qry-close-locally cmd run-id area-dat params)
)))))
(define (rmt:update-db-stats run-id rawcmd params duration)
(mutex-lock! *db-stats-mutex*)
(handle-exceptions
exn
(begin
|
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
|
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
|
-
+
|
;;======================================================================
;; S E R V E R
;;======================================================================
(define (rmt:kill-server run-id)
(rmt:send-receive 'kill-server run-id (list run-id) area-dat))
(define (rmt:start-server run-id)
(define (rmt:start-server run-id area-dat)
(rmt:send-receive 'start-server 0 (list run-id) area-dat))
;;======================================================================
;; M I S C
;;======================================================================
(define (rmt:login run-id area-dat)
|