Skip to content

Commit

Permalink
dns: use undeprecated c-ares API
Browse files Browse the repository at this point in the history
c-ares marked `ares_process()` deprecated in 1.28.1

in this change, we use `ares_process_fd()` in favor of the deprecated
`ares_process()`.

Refs scylladb#2197
Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Oct 6, 2024
1 parent a30ec0c commit 85d4dc9
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/net/dns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -614,30 +614,23 @@ dns_resolver::impl::poll_sockets() {

n = 0;

for (auto & p : _sockets) {
auto & e = p.second;
auto fd = p.first;
auto r = FD_ISSET(p.first, &readers);
auto w = FD_ISSET(p.first, &writers);
for (auto& [fd, e] : _sockets) {
auto r = FD_ISSET(fd, &readers);
auto w = FD_ISSET(fd, &writers);
auto ra = e.avail & POLLIN;
auto wa = e.avail & POLLOUT;

dns_log.trace("fd {} {}{}/{}{}", fd, (r ? "r" : ""),
(w ? "w" : ""), (ra ? "r" : ""),
(wa ? "w" : ""));

if (!wa) {
FD_CLR(fd, &writers);
}
if (!ra) {
FD_CLR(fd, &readers);
}
if (FD_ISSET(fd, &writers) || FD_ISSET(fd, &readers)) {
ares_socket_t read_fd = r && ra ? fd : ARES_SOCKET_BAD;
ares_socket_t write_fd = w && wa ? fd : ARES_SOCKET_BAD;
if (read_fd != ARES_SOCKET_BAD || write_fd != ARES_SOCKET_BAD) {
ares_process_fd(_channel, read_fd, write_fd);
++n;
}
}

ares_process(_channel, &readers, &writers);
} while (n != 0);
}

Expand Down

0 comments on commit 85d4dc9

Please sign in to comment.