64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
(let ((server-dat (and run-id (hash-table-ref/default *runremote* run-id #f))))
(if server-dat
(let ((start-res (http-transport:client-connect run-id ;; NB// confusion over server-dat and connection result!
(car server-dat)
(cadr server-dat))))
(if start-res ;; sucessful login?
start-res
(if (eq? remaining-tries 4)
(begin ;; login failed
(hash-table-delete! *runremote* run-id)
(open-run-close tasks:server-force-clean-run-record
tasks:open-db
run-id
(car server-dat)
(cadr server-dat)
" client:setup (server-dat=#t)")
(thread-sleep! 5)
(client:setup run-id remaining-tries: 10)) ;; (- remaining-tries 1)))
(begin
(thread-sleep! 5)
(client:setup run-id remaining-tries: (- remaining-tries 1))))))
(let* ((server-dat (open-run-close tasks:get-server tasks:open-db run-id)))
(if server-dat
(let ((start-res (http-transport:client-connect run-id
(tasks:hostinfo-get-interface server-dat)
(tasks:hostinfo-get-port server-dat))))
(if start-res
start-res
(if (eq? remaining-tries 2)
(begin ;; login failed
(hash-table-delete! *runremote* run-id)
(open-run-close tasks:server-force-clean-run-record
tasks:open-db
run-id
(tasks:hostinfo-get-interface server-dat)
(tasks:hostinfo-get-port server-dat)
" client:setup (server-dat = #f)")
(thread-sleep! 2)
(server:try-running run-id)
(thread-sleep! 10) ;; give server a little time to start up
(client:setup run-id remaining-tries: 10)) ;; (- remaining-tries 1)))
(begin
(thread-sleep! 5)
(client:setup run-id remaining-tries: (- remaining-tries 1))))))
(begin ;; no server registered
(thread-sleep! 2)
(server:try-running run-id)
(thread-sleep! 10) ;; give server a little time to start up
(client:setup run-id remaining-tries: (- remaining-tries 1)))))))))
;; keep this as a function to ease future
(define (client:start run-id server-info)
(http-transport:client-connect run-id
(tasks:hostinfo-get-interface server-info)
(tasks:hostinfo-get-port server-info)))
|
|
>
>
>
|
>
|
>
>
>
>
>
>
|
>
>
|
|
|
|
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
(let ((server-dat (and run-id (hash-table-ref/default *runremote* run-id #f))))
(if server-dat
(let ((start-res (http-transport:client-connect run-id ;; NB// confusion over server-dat and connection result!
(car server-dat)
(cadr server-dat))))
(if start-res ;; sucessful login?
start-res
(if (member remaining-tries '(3 4 6))
(begin ;; login failed
(debug:print 25 "INFO: client:setup start-res=" start-res ", run-id=" run-id ", server-dat=" server-dat)
(hash-table-delete! *runremote* run-id)
(open-run-close tasks:server-force-clean-run-record
tasks:open-db
run-id
(car server-dat)
(cadr server-dat)
" client:setup (server-dat=#t)")
(thread-sleep! 5)
(client:setup run-id remaining-tries: 10)) ;; (- remaining-tries 1)))
(begin
(debug:print 25 "INFO: client:setup start-res=" start-res ", run-id=" run-id ", server-dat=" server-dat)
(thread-sleep! 5)
(client:setup run-id remaining-tries: (- remaining-tries 1))))))
;; YUK: rename server-dat here
(let* ((server-dat (open-run-close tasks:get-server tasks:open-db run-id)))
(if server-dat
(let ((start-res (http-transport:client-connect run-id
(tasks:hostinfo-get-interface server-dat)
(tasks:hostinfo-get-port server-dat))))
(if start-res
start-res
(if (member remaining-tries '(2 5))
(begin ;; login failed
(debug:print 25 "INFO: client:setup start-res=" start-res ", run-id=" run-id ", server-dat=" server-dat)
(hash-table-delete! *runremote* run-id)
(open-run-close tasks:server-force-clean-run-record
tasks:open-db
run-id
(tasks:hostinfo-get-interface server-dat)
(tasks:hostinfo-get-port server-dat)
" client:setup (server-dat = #t)")
(thread-sleep! 2)
(server:try-running run-id)
(thread-sleep! 10) ;; give server a little time to start up
(client:setup run-id remaining-tries: 10)) ;; (- remaining-tries 1)))
(begin
(debug:print 25 "INFO: client:setup start-res=" start-res ", run-id=" run-id ", server-dat=" server-dat)
(thread-sleep! 5)
(client:setup run-id remaining-tries: (- remaining-tries 1))))))
(begin ;; no server registered
(if (eq? remaining-tries 2)
(begin
(open-run-close tasks:server-clean-out-old-records-for-run-id tasks:open-db run-id " client:setup (server-dat=#f)")
(client:setup run-id remaining-tries: 10))
(begin
(thread-sleep! 2)
(debug:print 25 "INFO: client:setup start-res (not defined here), run-id=" run-id ", server-dat=" server-dat)
(if (< (open-run-close tasks:num-in-available-state tasks:open-db run-id) 3)
(server:try-running run-id))
(thread-sleep! 10) ;; give server a little time to start up
(client:setup run-id remaining-tries: (- remaining-tries 1)))))))))))
;; keep this as a function to ease future
(define (client:start run-id server-info)
(http-transport:client-connect run-id
(tasks:hostinfo-get-interface server-info)
(tasks:hostinfo-get-port server-info)))
|