219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
-
+
|
(< (current-seconds) (conndat-expires conn)))
conn ;; we are current and good to go - we'll deal elsewhere with a server that was killed or died
;; Below we will find or create and connect to main
(let* ((dbname (db:run-id->dbname #f))
(the-srv (rmt:find-main-server apath dbname))
(start-main-srv (lambda () ;; call IF there is no the-srv found
(api:run-server-process apath dbname)
(thread-sleep! 4)
(thread-sleep! 1)
(rmt:open-main-connection remdat apath) ;; TODO: Add limit to number of tries
)))
(if (not the-srv) ;; have server, try connecting to it
(start-main-srv)
(let* ((srv-addr (server-address the-srv)) ;; need serv
(ipaddr (alist-ref 'ipaddr the-srv))
(port (alist-ref 'port the-srv))
|