-
Notifications
You must be signed in to change notification settings - Fork 30k
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
dns: make library_inited_
state global
#14738
dns: make library_inited_
state global
#14738
Conversation
Once `ares_library_init(ARES_LIB_INIT_ALL)` succeeded, it shouldn't be initialized again. So make the flag `library_inited_` global.
Just in case it isn’t obvious, |
@addaleax but in semantic I think making it global is better. |
What's more, I think we shoudn't clean the environment up in |
Well, for the current approach that’s what makes sense; init in the constructor, cleanup in the destructor. I don’t oppose this change, it’s just chaining two pieces of global state instead of having a single one, but I don’t think I’m +1 on it, just because global state generally is an antipattern. It happens to make no difference for Node as it is because there’s always a single |
@addaleax Sorry but I just saw the source code of C-ARES. It will plus So I think this PR could be closed now. |
@XadillaX That’s your call. But I can see why what I wrote might be confusing; maybe it’s better to add comments explaining why the current code is fine? |
@addaleax Yes I think so. Because when I saw the name of the function |
@XadillaX Okay; do you want to add the comments or should I? |
@addaleax I think you're better than me because my English is not that good. It'll take a long time to review if I do the comment. |
Once
ares_library_init(ARES_LIB_INIT_ALL)
succeeded, it shouldn't beinitialized again. So make the flag
library_inited_
global.Checklist
make -j4 test
passesAffected core subsystem(s)
dns, c-ares