Adding some debugging notes
This commit is contained in:
parent
86b0595795
commit
270581377b
|
@ -56,7 +56,6 @@
|
||||||
#:responders-servlet-loading [responders-servlet-loading servlet-loading-responder]
|
#:responders-servlet-loading [responders-servlet-loading servlet-loading-responder]
|
||||||
#:responders-servlet [responders-servlet servlet-error-responder])
|
#:responders-servlet [responders-servlet servlet-error-responder])
|
||||||
(lambda (conn req)
|
(lambda (conn req)
|
||||||
(define uri (request-uri req))
|
|
||||||
(define instance-custodian (make-servlet-custodian))
|
(define instance-custodian (make-servlet-custodian))
|
||||||
(parameterize ([current-custodian instance-custodian]
|
(parameterize ([current-custodian instance-custodian]
|
||||||
[current-execution-context (make-execution-context req)]
|
[current-execution-context (make-execution-context req)]
|
||||||
|
@ -64,13 +63,21 @@
|
||||||
(lambda (r)
|
(lambda (r)
|
||||||
(kill-connection! conn)
|
(kill-connection! conn)
|
||||||
(custodian-shutdown-all instance-custodian))])
|
(custodian-shutdown-all instance-custodian))])
|
||||||
|
(define uri (request-uri req))
|
||||||
(define maybe-response
|
(define maybe-response
|
||||||
(with-handlers ([exn:fail:filesystem:exists?
|
(with-handlers ([exn:fail:filesystem:exists?
|
||||||
(lambda (the-exn) (next-dispatcher))]
|
(lambda (the-exn) (next-dispatcher))]
|
||||||
[exn:dispatcher? raise]
|
[exn:dispatcher? raise]
|
||||||
[(lambda (x) #t)
|
[(lambda (x) #t)
|
||||||
(lambda (the-exn) (responders-servlet-loading uri the-exn))])
|
(lambda (the-exn)
|
||||||
|
(responders-servlet-loading uri the-exn))])
|
||||||
|
;; This could cause the servlet to be initialized, so we
|
||||||
|
;; need to make sure that if it errors, the right kind of
|
||||||
|
;; error will happen.
|
||||||
(define the-servlet (url->servlet uri))
|
(define the-servlet (url->servlet uri))
|
||||||
|
;; If it didn't cause initialization, then we need to switch
|
||||||
|
;; to the custodian that it started with, among other
|
||||||
|
;; things, including throwing a different kind of error
|
||||||
(parameterize ([current-servlet the-servlet]
|
(parameterize ([current-servlet the-servlet]
|
||||||
[current-custodian (servlet-custodian the-servlet)]
|
[current-custodian (servlet-custodian the-servlet)]
|
||||||
[current-directory (servlet-directory the-servlet)]
|
[current-directory (servlet-directory the-servlet)]
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
(define (new-connection time-to-live i-port o-port cust close?)
|
(define (new-connection time-to-live i-port o-port cust close?)
|
||||||
(define conn
|
(define conn
|
||||||
(make-connection
|
(make-connection
|
||||||
(begin0 (unbox i) (set-box! i (add1 (unbox i))))
|
;; The id is just for debugging and isn't normally useful
|
||||||
|
0 ;; (begin0 (unbox i) (set-box! i (add1 (unbox i))))
|
||||||
#f i-port o-port cust close?))
|
#f i-port o-port cust close?))
|
||||||
(define conn-wb (make-weak-box conn))
|
(define conn-wb (make-weak-box conn))
|
||||||
(set-connection-timer!
|
(set-connection-timer!
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
racket/async-channel
|
racket/async-channel
|
||||||
racket/port
|
racket/port
|
||||||
mzlib/thread)
|
mzlib/thread)
|
||||||
|
(require racket/format)
|
||||||
(require "web-server-structs.rkt"
|
(require "web-server-structs.rkt"
|
||||||
"connection-manager.rkt"
|
"connection-manager.rkt"
|
||||||
"dispatch-server-sig.rkt")
|
"dispatch-server-sig.rkt")
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
(thread
|
(thread
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let loop ([timers null])
|
(let loop ([timers null])
|
||||||
#;(printf "Timers: ~a\n" (length timers))
|
;; (printf "Timers: ~a\n" (length timers))
|
||||||
;; Wait for either...
|
;; Wait for either...
|
||||||
(apply sync
|
(apply sync
|
||||||
;; ... a timer-request message ...
|
;; ... a timer-request message ...
|
||||||
|
|
Loading…
Reference in New Issue
Block a user