move global variables in httpd-logging to preserved-thread-fluids

This commit is contained in:
interp 2002-09-05 10:55:30 +00:00
parent f9060d992a
commit becf14ce30
3 changed files with 60 additions and 54 deletions

View File

@ -35,6 +35,11 @@
((httpd-options-simultaneous-requests options) ((httpd-options-simultaneous-requests options)
=> make-rate-limiter) => make-rate-limiter)
(else #f)))) (else #f))))
(let-thread-fluid
logging
(make-logging)
(lambda ()
(init-http-log! options) (init-http-log! options)
(with-syslog-destination (with-syslog-destination
"httpd" #f #f #f "httpd" #f #f #f
@ -90,7 +95,7 @@
(http-syslog (syslog-level info) "<~a>~a [closed]~%" (http-syslog (syslog-level info) "<~a>~a [closed]~%"
(pid) (pid)
(format-internet-host-address host-address))))))))) (format-internet-host-address host-address)))))))))
port)))))) port))))))))
;;; Top-level http request processor ;;; Top-level http request processor

View File

@ -16,14 +16,14 @@
(http-syslog-proc do-nothing-proc) ;proc to run for syslog (level fmt . args) (http-syslog-proc do-nothing-proc) ;proc to run for syslog (level fmt . args)
(dns-lookup? #f)) ;perform dns-lookups? (dns-lookup? #f)) ;perform dns-lookups?
(define logging (make-fluid #f)) (define logging (make-preserved-thread-fluid #f))
(define (make-fluid-selector selector) (define (make-fluid-selector selector)
(lambda () (selector (fluid logging)))) (lambda () (selector (thread-fluid logging))))
(define (make-fluid-setter setter) (define (make-fluid-setter setter)
(lambda (value) (lambda (value)
(setter (fluid logging) value))) (setter (thread-fluid logging) value)))
(define logging-http-log-proc (make-fluid-selector logging:http-log-proc)) (define logging-http-log-proc (make-fluid-selector logging:http-log-proc))
(define logging-http-syslog-proc (make-fluid-selector logging:http-syslog-proc)) (define logging-http-syslog-proc (make-fluid-selector logging:http-syslog-proc))
@ -51,7 +51,6 @@
(define (init-http-log! options) (define (init-http-log! options)
;; syslog has to be initialized before CLF-logging ;; syslog has to be initialized before CLF-logging
;; because the latter may generate syslog-messages ;; because the latter may generate syslog-messages
(set! logging (make-fluid (make-logging)))
(init-http-syslog! (httpd-options-syslog? options)) (init-http-syslog! (httpd-options-syslog? options))
(init-http-port-log! (httpd-options-logfile options)) (init-http-port-log! (httpd-options-logfile options))
(if (httpd-options-resolve-ips? options) (if (httpd-options-resolve-ips? options)

View File

@ -697,6 +697,7 @@
enumerated ; enum enumerated ; enum
architecture ; exception, os-error architecture ; exception, os-error
handle-fatal-error handle-fatal-error
httpd-read-options httpd-read-options
httpd-error httpd-error
@ -745,7 +746,8 @@
threads ; spawn threads ; spawn
dns ; dns-lookup-ip dns ; dns-lookup-ip
defrec-package ; define-record defrec-package ; define-record
fluids ; make-fluid et al. thread-fluids ; make-preserved-fluid et al.
scsh scsh
scheme) scheme)
(files (httpd logging))) (files (httpd logging)))