io: fix socket/fd port custodian registration
Register the port, not the file descriptor, especially since a TCP connection can have ports that share a file descriptor. Also, I think a weak reference in the custodian doesn't work as intended (visible through finalization) if the file descriptor is referenced with a callback that closes over the port.
This commit is contained in:
parent
cf08436e05
commit
11789ff8b0
|
@ -4,6 +4,7 @@
|
||||||
"../host/rktio.rkt"
|
"../host/rktio.rkt"
|
||||||
"../security/main.rkt"
|
"../security/main.rkt"
|
||||||
"../sandman/main.rkt"
|
"../sandman/main.rkt"
|
||||||
|
"../format/main.rkt"
|
||||||
"port-number.rkt"
|
"port-number.rkt"
|
||||||
"address.rkt"
|
"address.rkt"
|
||||||
"error.rkt")
|
"error.rkt")
|
||||||
|
|
|
@ -432,9 +432,9 @@
|
||||||
|
|
||||||
(define (register-fd-close custodian fd fd-refcount flush-handle port)
|
(define (register-fd-close custodian fd fd-refcount flush-handle port)
|
||||||
(unsafe-custodian-register custodian
|
(unsafe-custodian-register custodian
|
||||||
fd
|
port
|
||||||
;; in atomic mode
|
;; in atomic mode
|
||||||
(lambda (fd)
|
(lambda (port)
|
||||||
(when flush-handle
|
(when flush-handle
|
||||||
(plumber-flush-handle-remove! flush-handle))
|
(plumber-flush-handle-remove! flush-handle))
|
||||||
(if (input-port? port)
|
(if (input-port? port)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user