We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b87fae9 commit d7d22eaCopy full SHA for d7d22ea
src/cares_wrap.cc
@@ -489,6 +489,8 @@ void ChannelWrap::Setup() {
489
490
int r;
491
if (!library_inited_) {
492
+ // Multiple calls to ares_library_init() increase a reference counter,
493
+ // so this is a no-op except for the first call to it.
494
r = ares_library_init(ARES_LIB_INIT_ALL);
495
if (r != ARES_SUCCESS)
496
return env()->ThrowError(ToErrorCodeString(r));
@@ -516,8 +518,10 @@ void ChannelWrap::Setup() {
516
518
517
519
520
ChannelWrap::~ChannelWrap() {
- if (library_inited_)
521
+ if (library_inited_) {
522
+ // This decreases the reference counter increased by ares_library_init().
523
ares_library_cleanup();
524
+ }
525
526
ares_destroy(channel_);
527
CleanupTimer();
0 commit comments