102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
(define home (getenv "HOME"))
(define user (getenv "USER"))
;; Globals
;;
(define *server-loop-heart-beat* (current-seconds))
;; copied from egg call-with-environment-variables
;;
(define (call-with-environment-variables variables thunk)
;; @("Sets up environment variable via dynamic-wind which are taken down after thunk."
;; (variables "An alist of the form {{'((\"var\" . \"value\") ...)}}")
;; (thunk "The thunk to execute with a modified environment"))
|
>
>
|
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
(define home (getenv "HOME"))
(define user (getenv "USER"))
;; Globals
;;
(define *server-loop-heart-beat* (current-seconds))
(define *watchdog* #f)
;; copied from egg call-with-environment-variables
;;
(define (call-with-environment-variables variables thunk)
;; @("Sets up environment variable via dynamic-wind which are taken down after thunk."
;; (variables "An alist of the form {{'((\"var\" . \"value\") ...)}}")
;; (thunk "The thunk to execute with a modified environment"))
|
3549
3550
3551
3552
3553
3554
3555
3556
3557
|
(set! res adr)))
;; NOTE: This can fail when there is no mention of the host in /etc/hosts. FIXME
(vector->list (hostinfo-addresses (hostname->hostinfo hostname))))
(string-intersperse
(map number->string
(u8vector->list
(if res res (hostname->ip hostname)))) ".")))
)
|
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
|
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
|
(set! res adr)))
;; NOTE: This can fail when there is no mention of the host in /etc/hosts. FIXME
(vector->list (hostinfo-addresses (hostname->hostinfo hostname))))
(string-intersperse
(map number->string
(u8vector->list
(if res res (hostname->ip hostname)))) ".")))
(define (tests:readlines filename)
(call-with-input-file filename
(lambda (p)
(let loop ((line (read-line p))
(result '()))
(if (eof-object? line)
(reverse result)
(loop (read-line p) (cons line result)))))))
;; timeout is hms string: 1h 5m 3s, default is 1 minute
;;
(define (server:expiration-timeout)
(let ((tmo (configf:lookup *configdat* "server" "timeout")))
(if (and (string? tmo)
(common:hms-string->seconds tmo)) ;; BUG: hms-string->seconds is broken, if given "10" returns 0. Also, it doesn't belong in this logic unless the string->number is changed below
(* 3600 (string->number tmo))
60)))
)
|