• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PowerDNS / pdns / 19741624072

27 Nov 2025 03:45PM UTC coverage: 73.086% (+0.02%) from 73.065%
19741624072

Pull #16570

github

web-flow
Merge 08a2cdb1d into f94a3f63f
Pull Request #16570: rec: rewrite all unwrap calls in web.rs

38523 of 63408 branches covered (60.75%)

Branch coverage included in aggregate %.

128044 of 164496 relevant lines covered (77.84%)

6531485.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.48
/pdns/dnsdistdist/dnsdist-resolver.cc
1
/*
2
 * This file is part of PowerDNS or dnsdist.
3
 * Copyright -- PowerDNS.COM B.V. and its contributors
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of version 2 of the GNU General Public License as
7
 * published by the Free Software Foundation.
8
 *
9
 * In addition, for the avoidance of any doubt, permission is granted to
10
 * link this program with OpenSSL and to (re)distribute the binaries
11
 * produced as the result of such linking.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
 */
22
#include <vector>
23

24
#include "dnsdist-resolver.hh"
25
#include "iputils.hh"
26
#include "threadname.hh"
27

28
namespace dnsdist::resolver
29
{
30
void asynchronousResolver(const std::string& hostname, const std::function<void(const std::string& hostname, std::vector<ComboAddress>& ips)>& callback)
31
{
1✔
32
  setThreadName("dnsdist/resolve");
1✔
33
  addrinfo hints{};
1✔
34
  hints.ai_family = AF_UNSPEC;
1✔
35
  hints.ai_flags = AI_ADDRCONFIG;
1✔
36
  hints.ai_socktype = SOCK_DGRAM;
1✔
37
  addrinfo* infosRaw{nullptr};
1✔
38
  std::vector<ComboAddress> addresses;
1✔
39
  auto ret = getaddrinfo(hostname.c_str(), nullptr, &hints, &infosRaw);
1✔
40
  if (ret != 0) {
1!
41
    callback(hostname, addresses);
×
42
    return;
×
43
  }
×
44
  auto infos = std::unique_ptr<addrinfo, decltype(&freeaddrinfo)>(infosRaw, &freeaddrinfo);
1✔
45
  for (const auto* addr = infos.get(); addr != nullptr; addr = addr->ai_next) {
3✔
46
    try {
2✔
47
      addresses.emplace_back(addr->ai_addr, addr->ai_addrlen);
2✔
48
    }
2✔
49
    catch (...) {
2✔
50
    }
×
51
  }
2✔
52
  callback(hostname, addresses);
1✔
53
}
1✔
54
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc