Skip to content

Commit

Permalink
deps: cherry-pick 078e1dc from upstream c-ares
Browse files Browse the repository at this point in the history
Original commit message:

    Prevent changing name servers while queries are outstanding

    Changing name servers doesn't work, per c-ares/c-ares#41.
    Better to return an error code than to crash.

Refs: c-ares/c-ares#41
Refs: c-ares/c-ares#191
Refs: nodejs#894
  • Loading branch information
bnoordhuis committed Oct 22, 2018
1 parent d2fcd1d commit 836c45a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions deps/cares/src/ares_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ int ares_set_servers(ares_channel channel,
if (!channel)
return ARES_ENODATA;

if (!ares__is_list_empty(&channel->all_queries))
return ARES_ENOTIMP;

ares__destroy_servers_state(channel);

for (srvr = servers; srvr; srvr = srvr->next)
Expand Down Expand Up @@ -202,6 +205,9 @@ int ares_set_servers_ports(ares_channel channel,
if (!channel)
return ARES_ENODATA;

if (!ares__is_list_empty(&channel->all_queries))
return ARES_ENOTIMP;

ares__destroy_servers_state(channel);

for (srvr = servers; srvr; srvr = srvr->next)
Expand Down

0 comments on commit 836c45a

Please sign in to comment.