Closed ioquatix closed 1 year ago
Thanks - I know how that works, and we have similar code in ext/socket
.. I'm just wondering, should we allow for such a code where the underlying file descriptor can be modified?
Just because it was possible before, doesn't mean it was acceptable usage.
My feeling is, we are trying to avoid memory allocations (IO
instances). But should we? Doesn't it feel a bit odd to just change the file descriptor?
If we agree it makes sense, then we should introduce rb_io_descriptor_set(VALUE io, int descriptor)
or something. Bearing in mind, this won't work well on JRuby or other Ruby implementation that don't have the notion of a file descriptor.
It's not really about modifying fd's, more like creating new socket instances.
I just saw this: https://github.com/ruby/ruby/pull/7880
rb_io_open_descriptor(rb_cIO, master_fd, FMODE_READWRITE | FMODE_SYNC | FMODE_DUPLEX, master_path, RUBY_IO_TIMEOUT_DEFAULT, NULL);
Would that work for creating sockets?
Yes, that's the plan.
Cool! Thanks for keeping me in the loop!
No problem, I really love what you are doing and you are an important consumer of the interfaces I'm working on, so I want to ensure we are aligned.
Can you elaborate on
Backend_accept
case where it seems like you want to set the file descriptor?