Closed vcunat closed 5 years ago
@daurnimator: do I understand the code correctly that the only difference of dup
is that it duplicates the FD and owns the copy (i.e. closes it when the cqueues socket closes, or something like that).
EDIT: BTW, assuming that's so, I can't see why prefer .dup
in the systemd.socket
case.
do I understand the code correctly that the only difference of
dup
is that it duplicates the FD and owns the copy (i.e. closes it when the cqueues socket closes, or something like that).
Yes: dup
makes a copy while fdopen
takes ownership.
BTW, assuming that's so, I can't see why prefer
.dup
in thesystemd.socket
case.
You don't. as I said above: "systemd fd storage is a correct usecase" (for .fdopen
)
I'm not sure about the exact formulations... is this OK? Feel free to amend and push directly a version you like.
Added. I actually didn't realize that you don't seem to have write access to this repo :-)
BTW, I didn't document that you can pass a table with .fd
to these functions. I can't see an advantage when there's only one parameter.
I consider it quite an important function for e.g. systemd-based services, so I'd feel better if it were officially blessed (in docs).
I only spent a few minutes looking at the sources, trying to document the exact meaning, so it might not be accurate. Still, it worked OK for us in combination with
http.server.new()