Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

expose ares_get_servers in cares_wrap #3132

Closed
wants to merge 1 commit into from

Conversation

tjfontaine
Copy link

This exposes ares_get_servers as cares_wrap.getServers which passes to a callback an array of IPs that ares is currently using for resolution.

It's callback based with an eye towards #3018 where ares would be initialized on the thread pool during platform initialization only to retrieve relevant platform information and then be immediately disposed.

cur = cur->next;
}

callback->Call(Context::GetCurrent()->Global(), 1, argv);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's a synchronous function, you don't have to make a callback, just return the result. Callbacks are supposed to run on the next tick of the event loop anyway.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but if/when the pure js dns implementation happens, then ares would only be initialized (on the thread pool) when needing to get this information and then disposed. So I designed it this way so I could use it in the module now and not change the consuming code if/when #3018 is merged.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, fair enough. Can you add a JS shim that defers the callback to the next tick?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants