-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Official socket transfer support #8974
Comments
Once you call
|
Windows version has no .fd of its _handle. |
I think the first step in solving this is to agree on an interface. When that is done, the implementation should be very simple. I know @bnoordhuis is against the idea of simply exposing the native SOCKET handle on Windows and he seems to prefer having a strictly transferring-only interface so that addons do not mess around with the internals of any still existing Node.js object. |
Any kind of net.Socket.export((fd, ssl) => { works perfectly for me |
@bnoordhuis @indutny @nodejs/streams @nodejs/n-api Thoughts on how to do it now, how a new feature might do it, whether it is something that should be done at all, whether or not this issue should remain open? |
I think the best way to do this is via uv_link_t, if that would ever be supported here. This is an issue also on core itsef, as I would love to not pass through JS to read data from TLS. https://github.com/indutny/uv_link_t I do not think that manipulating directly the fd and pointers is the way to go. Linking to the OpenSSL version that node use is impossible (I could not do it, maybe someone else can), so allowing this is not a good idea. |
It's a pretty niche thing. Not saying no but there would probably only be a few users at best, making it not worthwhile to sink a lot of time into. There's also the question of if you want to manage sockets yourself, why not create them yourself?
This has improved in the last year, see #6274. |
@bnoordhuis thanks! |
It's been a year since this issue was filed and there doesn't seem to be a whole lot of interest, never mind the practical considerations. #7627 was closed as well so I'll close this out too. Please reopen if you think this needs to be revisited. |
I'm interested in an official way of transferring a socket from Node.js (net.Socket / tls.TLSSocket) representation to the native representation (file descriptor / SOCKET descriptor + SSL pointer).
This can be used to transfer a connection from JS land into an addon, and have the addon manage the connection way more efficient.
The text was updated successfully, but these errors were encountered: