crypto: export externals to internal structs#8355
crypto: export externals to internal structs#8355indutny wants to merge 1 commit intonodejs:v0.12from
Conversation
Export External getters for a internal structs: SSL, SSL_CTX.
|
cc @trevnorris ;) |
|
For those, who just came over it. I'm going to export some If you guys do need some other pointers - please comment here. |
|
Why the indirect approach? There is no reference counting going on which is asking for use-after-free bugs. If the goal is to expose internals to native add-ons, then why not expose them directly through node.h? |
|
@bnoordhuis because it is very easy? :) On a more serious note: there are some classes like Anyway, I'm open to suggestions and please paste some example methods if you a better idea ;) |
|
Is the idea to expose the SSL and SSL_CTX pointers with TLSCallbacks::Wrap()-wrapped JS objects as the input? What about lifetimes? Is the caller allowed to borrow the references for longer periods of time? I think I'd start out conservative with something like: Local<Object> js_tls_object = /* ... */;
{
node::Borrow<SSL> ssl(js_tls_object);
CHECK_NE(*ssl, NULL);
do_something_with(*ssl);
}It's not perfect but it makes it clear that the lifetime of the |
|
Hm... in such context - object will be alive anyway, even without on-stack guard, right? Let's be honest about SSL, SSL_CTX. What I was thinking about - is providing some Anyway, this is not a documented feature, and is mostly a way for some people to write useful addons without caring much about stable version API/ABI. |
|
Landed in 6e08bb9, ignoring most of the feedback. Thank you :) |
Export External getters for a internal structs: SSL, SSL_CTX.
cc @tjfontaine , as discussed on nodeconf.