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"
|
||||
"../security/main.rkt"
|
||||
"../sandman/main.rkt"
|
||||
"../format/main.rkt"
|
||||
"port-number.rkt"
|
||||
"address.rkt"
|
||||
"error.rkt")
|
||||
|
|
|
@ -432,9 +432,9 @@
|
|||
|
||||
(define (register-fd-close custodian fd fd-refcount flush-handle port)
|
||||
(unsafe-custodian-register custodian
|
||||
fd
|
||||
port
|
||||
;; in atomic mode
|
||||
(lambda (fd)
|
||||
(lambda (port)
|
||||
(when flush-handle
|
||||
(plumber-flush-handle-remove! flush-handle))
|
||||
(if (input-port? port)
|
||||
|
|
Loading…
Reference in New Issue
Block a user