149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
-
-
+
+
|
;; If file exists AND
;; file NOT readable
;; ==> open in-mem version
;; If file NOT exists
;; ==> open in-mem version
;;
(define (tasks:open-db #!key (numretries 4))
(if *task-db*
*task-db*
(if (bdat-task-db *bdat*)
(bdat-task-db *bdat*)
(handle-exceptions
exn
(if (> numretries 0)
(begin
(print-call-chain (current-error-port))
(debug:print 0 *default-log-port* " message: " ((condition-property-accessor 'exn 'message) exn))
(debug:print 5 *default-log-port* " exn=" (condition->list exn))
|
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
-
-
+
+
|
hostname TEXT,
cmdline TEXT,
login_time TIMESTAMP,
logout_time TIMESTAMP DEFAULT -1,
CONSTRAINT clients_constraint UNIQUE (pid,hostname));")
;))
(set! *task-db* (cons mdb dbpath))
*task-db*))))
(bdat-task-db-set! *bdat* (cons mdb dbpath))
(bdat-task-db *bdat*)))))
;;======================================================================
;; Server and client management
;;======================================================================
;; make-vector-record tasks hostinfo id interface port pubport transport pid hostname
(define (tasks:hostinfo-get-id vec) (vector-ref vec 0))
|