43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
(string->number (cadr lst))
#f)))
(if port (vector (car lst) port) #f)))
(let* ((rpc:listener (server:find-free-port-and-open (rpc:default-server-port)))
(th1 (make-thread
(cute (rpc:make-server rpc:listener) "rpc:server")
'rpc:server))
(th2 (make-thread (lambda ()(db:updater))))
(hostname (if (string=? "-" hostn)
(get-host-name)
hostn))
(ipaddrstr (if (string=? "-" hostn)
(string-intersperse (map number->string (u8vector->list (hostname->ip hostname))) ".")
#f))
(host:port (conc (if ipaddrstr ipaddrstr hostname) ":" (rpc:default-server-port))))
|
|
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
(string->number (cadr lst))
#f)))
(if port (vector (car lst) port) #f)))
(let* ((rpc:listener (server:find-free-port-and-open (rpc:default-server-port)))
(th1 (make-thread
(cute (rpc:make-server rpc:listener) "rpc:server")
'rpc:server))
;; (th2 (make-thread (lambda ()(db:updater))))
(hostname (if (string=? "-" hostn)
(get-host-name)
hostn))
(ipaddrstr (if (string=? "-" hostn)
(string-intersperse (map number->string (u8vector->list (hostname->ip hostname))) ".")
#f))
(host:port (conc (if ipaddrstr ipaddrstr hostname) ":" (rpc:default-server-port))))
|
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
(set! queue-len (length *incoming-data*))
(mutex-unlock! *incoming-mutex*)
(if (> queue-len 0)
(begin
(debug:print-info 0 "Queue not flushed, waiting ...")
(loop (+ n 1)))))
)))
(thread-start! th1)
;; (debug:print 0 "Server started on port " (rpc:default-server-port) "...")
(thread-start! th2)
;; (thread-join! th2)
;; return th2 for the calling process to do a join with
th2
)))) ;; rpc:server)))
(define (server:keep-running db host:port)
;; if none running or if > 20 seconds since
;; server last used then start shutdown
(let loop ((count 0))
(thread-sleep! 20) ;; no need to do this very often
|
>
|
|
|
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
(set! queue-len (length *incoming-data*))
(mutex-unlock! *incoming-mutex*)
(if (> queue-len 0)
(begin
(debug:print-info 0 "Queue not flushed, waiting ...")
(loop (+ n 1)))))
)))
(db:updater)
(thread-start! th1)
;; (debug:print 0 "Server started on port " (rpc:default-server-port) "...")
;; (thread-start! th2)
;; (thread-join! th2)
;; return th2 for the calling process to do a join with
th1
)))) ;; rpc:server)))
(define (server:keep-running db host:port)
;; if none running or if > 20 seconds since
;; server last used then start shutdown
(let loop ((count 0))
(thread-sleep! 20) ;; no need to do this very often
|