• 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

82.86
/pdns/dnsdistdist/dnsdist-configuration.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

23
#include "dnsdist-configuration.hh"
24
#include "sholder.hh"
25

26
namespace dnsdist::configuration
27
{
28
static GlobalStateHolder<RuntimeConfiguration> s_currentRuntimeConfiguration;
29
static ImmutableConfiguration s_immutableConfiguration;
30
static std::atomic<bool> s_immutableConfigurationDone{false};
31

32
static const RuntimeConfiguration& getCurrentRuntimeConfigurationInternal(bool refresh)
33
{
9,657,643✔
34
  static thread_local auto t_threadLocalConfiguration = s_currentRuntimeConfiguration.getLocal();
9,657,643✔
35
  return t_threadLocalConfiguration.get(!refresh);
9,657,643✔
36
}
9,657,643✔
37

38
const RuntimeConfiguration& getCurrentRuntimeConfiguration()
39
{
9,622,211✔
40
  return getCurrentRuntimeConfigurationInternal(false);
9,622,211✔
41
}
9,622,211✔
42

43
const RuntimeConfiguration& refreshLocalRuntimeConfiguration()
44
{
38,415✔
45
  return getCurrentRuntimeConfigurationInternal(true);
38,415✔
46
}
38,415✔
47

48
void updateRuntimeConfiguration(const std::function<void(RuntimeConfiguration&)>& mutator)
49
{
8,807✔
50
  s_currentRuntimeConfiguration.modify(mutator);
8,807✔
51
  /* refresh the local "cache" right away */
52
  refreshLocalRuntimeConfiguration();
8,807✔
53
}
8,807✔
54

55
void updateImmutableConfiguration(const std::function<void(ImmutableConfiguration&)>& mutator)
56
{
1,327✔
57
  if (isImmutableConfigurationDone()) {
1,327!
58
    throw std::runtime_error("Trying to update an immutable setting at runtime!");
×
59
  }
×
60

61
  mutator(s_immutableConfiguration);
1,327✔
62
}
1,327✔
63

64
const ImmutableConfiguration& getImmutableConfiguration()
65
{
751,084✔
66
  return s_immutableConfiguration;
751,084✔
67
}
751,084✔
68

69
bool isImmutableConfigurationDone()
70
{
2,373✔
71
  return s_immutableConfigurationDone.load();
2,373✔
72
}
2,373✔
73

74
void setImmutableConfigurationDone()
75
{
400✔
76
  if (s_immutableConfigurationDone.exchange(true)) {
400!
77
    throw std::runtime_error("Trying to seal the runtime-immutable configuration a second time");
×
78
  }
×
79
}
400✔
80
}
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