| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b87fae9 commit d7d22ea
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -489,6 +489,8 @@ void ChannelWrap::Setup() { | |||
| 489 | 489 | ||
| 490 | 490 | int r; | |
| 491 | 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. | ||
| 492 | 494 | r = ares_library_init(ARES_LIB_INIT_ALL); | |
| 493 | 495 | if (r != ARES_SUCCESS) | |
| 494 | 496 | return env()->ThrowError(ToErrorCodeString(r)); | |
@@ -516,8 +518,10 @@ void ChannelWrap::Setup() { | |||
| 516 | 518 | ||
| 517 | 519 | ||
| 518 | 520 | ChannelWrap::~ChannelWrap() { | |
| 519 | - if (library_inited_) | ||
| 521 | + if (library_inited_) { | ||
| 522 | + // This decreases the reference counter increased by ares_library_init(). | ||
| 520 | 523 | ares_library_cleanup(); | |
| 524 | + } | ||
| 521 | 525 | ||
| 522 | 526 | ares_destroy(channel_); | |
| 523 | 527 | CleanupTimer(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments