153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
(hash-table-set! *server-kind-run* run-id (current-seconds))))))
;; The generic run a server command. Dispatches the call to server 0 if run-id != 0
;;
(define (server:try-running run-id area-dat)
(if (eq? run-id 0)
(server:run run-id area-dat)
(rmt:start-server run-id)))
(define (server:check-if-running run-id area-dat)
(let ((tdbdat (tasks:open-db area-dat)))
(let loop ((server (tasks:get-server (db:delay-if-busy tdbdat area-dat) run-id))
(trycount 0))
(if server
;; note: client:start will set (common:get-remote remote). this needs to be changed
|
|
|
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
(hash-table-set! *server-kind-run* run-id (current-seconds))))))
;; The generic run a server command. Dispatches the call to server 0 if run-id != 0
;;
(define (server:try-running run-id area-dat)
(if (eq? run-id 0)
(server:run run-id area-dat)
(rmt:start-server run-id area-dat)))
(define (server:check-if-running run-id area-dat)
(let ((tdbdat (tasks:open-db area-dat)))
(let loop ((server (tasks:get-server (db:delay-if-busy tdbdat area-dat) run-id))
(trycount 0))
(if server
;; note: client:start will set (common:get-remote remote). this needs to be changed
|
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
(not server-db-dat))
(begin
(print "ERROR: bad host:port")
(exit 1))
(let* ((iface (if host-port (car host-port) (tasks:hostinfo-get-interface server-db-dat)))
(port (if host-port (cadr host-port)(tasks:hostinfo-get-port server-db-dat)))
(server-dat (http-transport:client-connect iface port))
(login-res (rmt:login-no-auto-client-setup server-dat run-id)))
(if (and (list? login-res)
(car login-res))
(begin
(print "LOGIN_OK")
(exit 0))
(begin
(print "LOGIN_FAILED")
|
|
|
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
(not server-db-dat))
(begin
(print "ERROR: bad host:port")
(exit 1))
(let* ((iface (if host-port (car host-port) (tasks:hostinfo-get-interface server-db-dat)))
(port (if host-port (cadr host-port)(tasks:hostinfo-get-port server-db-dat)))
(server-dat (http-transport:client-connect iface port))
(login-res (rmt:login-no-auto-client-setup server-dat run-id area-dat)))
(if (and (list? login-res)
(car login-res))
(begin
(print "LOGIN_OK")
(exit 0))
(begin
(print "LOGIN_FAILED")
|