104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
-
+
|
(define *bdat* #f) ;; the one and only (someday) global?
(defstruct bdat
(home (getenv "HOME"))
(user (getenv "USER"))
(watchdog #f)
(time-to-exit #f)
(server-loop-heart-beat (current-seconds))
)
(define (make-and-init-bigdata)
(set! *bdat*
(make-bdat)))
|
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
-
+
|
(define *my-client-signature* #f)
(define *transport-type* 'http) ;; override with [server] transport http|rpc|nmsg
(define *runremote* #f) ;; if set up for server communication this will hold <host port>
;; (define *max-cache-size* 0)
(define *logged-in-clients* (make-hash-table))
(define *server-id* #f)
(define *server-info* #f) ;; good candidate for easily convert to non-global
(define *time-to-exit* #f)
;; (define *time-to-exit* #f)
(define *server-run* #t)
(define *run-id* #f)
(define *server-kind-run* (make-hash-table))
(define *home-host* #f)
;; (define *total-non-write-delay* 0)
(define *heartbeat-mutex* (make-mutex))
(define *api-process-request-count* 0)
|
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
|
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
|
-
+
-
+
|
;; common:readonly-watchdo
;; common:watchdog
;; std-exit-procedure was here
(define (std-signal-handler signum)
;; (signal-mask! signum)
(set! *time-to-exit* #t)
(bdat-time-to-exit-set! *bdat* #t)
;;(debug:print-info 13 *default-log-port* "got signal "signum)
(debug:print-error 0 *default-log-port* "Received signal " signum " aaa exiting promptly")
;; (std-exit-procedure) ;; shouldn't need this since we are exiting and it will be called anyway
(exit))
(define (special-signal-handler signum)
;; (signal-mask! signum)
(set! *time-to-exit* #t)
(bdat-time-to-exit-set! *bdat* #t)
;;(debug:print-info 13 *default-log-port* "got signal "signum)
(debug:print-error 0 *default-log-port* "Received signal " signum " sending email befor exiting!!")
;;TODO send email to notify admin contact listed in the config that the lisner got killed
;; (std-exit-procedure) ;; shouldn't need this since we are exiting and it will be called anyway
(exit))
(set-signal-handler! signal/int std-signal-handler) ;; ^C
|