socket {fd, Fd} enhancement

Steve Vinoski vinoski@REDACTED
Fri Nov 6 07:36:11 CET 2009


Some gen_tcp functions allow {fd, Fd} to be passed in to make the resulting
sockets use an already-opened file descriptor instead of opening their own.
This is invaluable for certain applications. Unfortunately, calling close on
such sockets always leaves any passed-in Fd open -- I guess the design is
such that it assumes that whatever originally opened the Fd would want to
close it too.

Is there any chance of getting a new option to have the close function close
not only the socket but the passed-in Fd too? Or to allow the application to
pass along a callback of some sort that will get called to close the Fd when
the socket is closed?

I'd be happy to help prepare and test a patch along these lines if there's
any interest in adding this.

thanks,
--steve


More information about the erlang-bugs mailing list