268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
|
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
-
+
-
+
-
+
+
+
|
;;
(define (rmt:general-open-connection remote apath dbname #!key (num-tries 5))
(let ((mainconn (rmt:get-connection remote apath (db:run-id->dbname #f))))
;; (debug:print 0 *default-log-port* "remote: " remote)
(if (not mainconn)
(begin
(rmt:open-main-connection remote apath)
(thread-sleep! 1)
(thread-sleep! 2)
(rmt:general-open-connection remote apath dbname))
;; we have a connection to main, ask for contact info for dbname
(let* ((res (rmt:send-receive 'get-server #f `(,apath ,dbname))))
(let* ((res (rmt:send-receive-real remote apath dbname 'get-server #f `(,apath ,dbname))))
(case res
((server-started)
(if (> num-tries 0)
(begin
(thread-sleep! 2)
(rmt:general-open-connection remote apath dbname num-tries: (- num-tries 1)))
(rmt:general-open-connection remote apath dbname
num-tries: (- num-tries 1)))
'failed))
(else
(debug:print-info 0 *default-log-port* "Unexpected result: " res)
res))))))
;;======================================================================
;; Defaults to current area
;;
(define (rmt:send-receive cmd rid params #!key (attemptnum 1)(area-dat #f))
|