164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
;; (if (eq? run-id 0)
;; (server:run run-id)
;; (rmt:start-server run-id)))
(define server:try-running server:run) ;; there is no more per-run servers ;; REMOVE ME. BUG.
(define (server:start-attempted? areapath)
(let ((flagfile (conc areapath "/.starting-server")))
(and (file-exists? flagfile)
(< (- (current-seconds)
(file-modification-time flagfile))
15)))) ;; exists and less than 15 seconds old
(define (server:read-dotserver areapath)
(let ((dotfile (conc areapath "/.server")))
(if (and (file-exists? dotfile)
(file-read-access? dotfile))
(with-input-from-file
dotfile
(lambda ()
(read-line)))
#f)))
;; write a .server file in *toppath* with hostport
;; return #t on success, #f otherwise
;;
(define (server:write-dotserver areapath hostport)
(let ((lock-file (conc areapath "/.server.lock"))
(server-file (conc areapath "/.server")))
|
>
>
>
|
|
|
|
>
>
>
|
|
|
|
|
|
|
|
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
;; (if (eq? run-id 0)
;; (server:run run-id)
;; (rmt:start-server run-id)))
(define server:try-running server:run) ;; there is no more per-run servers ;; REMOVE ME. BUG.
(define (server:start-attempted? areapath)
(let ((flagfile (conc areapath "/.starting-server")))
(handle-exceptions
exn
#f ;; if things go wrong pretend we can't see the file
(and (file-exists? flagfile)
(< (- (current-seconds)
(file-modification-time flagfile))
15))))) ;; exists and less than 15 seconds old
(define (server:read-dotserver areapath)
(let ((dotfile (conc areapath "/.server")))
(handle-exceptions
exn
#f ;; if things go wrong pretend we can't see the file
(if (and (file-exists? dotfile)
(file-read-access? dotfile))
(with-input-from-file
dotfile
(lambda ()
(read-line)))
#f))))
;; write a .server file in *toppath* with hostport
;; return #t on success, #f otherwise
;;
(define (server:write-dotserver areapath hostport)
(let ((lock-file (conc areapath "/.server.lock"))
(server-file (conc areapath "/.server")))
|