Removing the thread previously introduced which is now no longer necessary given the real problem

original commit: dfb4bc112d3947566282d6e16ddb60ed72acac5e
This commit is contained in:
Jay McCarthy 2012-03-23 10:47:56 -06:00
parent 3f6a5bb5ef
commit 0cb4ef4c3e

View File

@ -79,56 +79,53 @@
;; PR still shows up, but it has no effect on the ;; PR still shows up, but it has no effect on the
;; response time/etc, whereas before it would stop ;; response time/etc, whereas before it would stop
;; listening and 'ab' would fail. ;; listening and 'ab' would fail.
(thread-wait (with-handlers
(thread ([exn:fail:network? handle-exn])
(λ () ;; Make a custodian for the next session:
(with-handlers (let ([c (make-custodian)])
([exn:fail:network? handle-exn]) (parameterize
;; Make a custodian for the next session: ([current-custodian c])
(let ([c (make-custodian)]) ;; disable breaks during session set-up...
(parameterize (parameterize-break
([current-custodian c]) #f
;; disable breaks during session set-up... ;; ... but enable breaks while blocked on an accept:
(parameterize-break (let-values ([(r w) ((if can-break?
#f tcp-accept/enable-break
;; ... but enable breaks while blocked on an accept: tcp-accept)
(let-values ([(r w) ((if can-break? l)])
tcp-accept/enable-break ;; Handler thread:
tcp-accept) (let ([t
l)]) (thread
;; Handler thread: (lambda ()
(let ([t ;; First, install the parameterization
(thread ;; used for all connections:
(call-with-parameterization
paramz
(lambda () (lambda ()
;; First, install the parameterization ;; Install this connection's custodian
;; used for all connections: ;; for this thread in the shared
(call-with-parameterization ;; parameterization:
paramz (current-custodian c)
(lambda () ;; Enable breaking:
;; Install this connection's custodian (when can-break?
;; for this thread in the shared (break-enabled #t))
;; parameterization: ;; Prevent the handler from
(current-custodian c) ;; killing this custodian, by
;; Enable breaking: ;; creating an intermediary,
(when can-break? ;; but child custodian
(break-enabled #t)) (parameterize ([current-custodian
;; Prevent the handler from (make-custodian)])
;; killing this custodian, by ;; Call the handler
;; creating an intermediary, (handler r w))))))])
;; but child custodian ;; Clean-up and timeout thread:
(parameterize ([current-custodian (thread
(make-custodian)]) (lambda ()
;; Call the handler (sync/timeout connection-timeout t)
(handler r w))))))]) (when (thread-running? t)
;; Clean-up and timeout thread: ;; Only happens if connection-timeout is not #f
(thread (break-thread t))
(lambda () (sync/timeout connection-timeout t)
(sync/timeout connection-timeout t) (custodian-shutdown-all c)))))))))
(when (thread-running? t)
;; Only happens if connection-timeout is not #f
(break-thread t))
(sync/timeout connection-timeout t)
(custodian-shutdown-all c))))))))))))
(loop)))) (loop))))
(lambda () (tcp-close l))))) (lambda () (tcp-close l)))))