mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-02 15:45:25 +00:00
REQUIRE should not have side effects
it's a style violation to have REQUIRE or INSIST contain code that must run for the server to work. this was being done with some atomic_compare_exchange calls. these have been cleaned up. uses of atomic_compare_exchange in assertions have been replaced with a new macro atomic_compare_exchange_enforced, which uses RUNTIME_CHECK to ensure that the exchange was successful.
This commit is contained in:
@@ -3979,19 +3979,24 @@ dns_adbentry_overquota(dns_adbentry_t *entry) {
|
||||
|
||||
void
|
||||
dns_adb_beginudpfetch(dns_adb_t *adb, dns_adbaddrinfo_t *addr) {
|
||||
uint_fast32_t active;
|
||||
|
||||
REQUIRE(DNS_ADB_VALID(adb));
|
||||
REQUIRE(DNS_ADBADDRINFO_VALID(addr));
|
||||
|
||||
REQUIRE(atomic_fetch_add_relaxed(&addr->entry->active, 1) !=
|
||||
UINT32_MAX);
|
||||
active = atomic_fetch_add_relaxed(&addr->entry->active, 1);
|
||||
INSIST(active != UINT32_MAX);
|
||||
}
|
||||
|
||||
void
|
||||
dns_adb_endudpfetch(dns_adb_t *adb, dns_adbaddrinfo_t *addr) {
|
||||
uint_fast32_t active;
|
||||
|
||||
REQUIRE(DNS_ADB_VALID(adb));
|
||||
REQUIRE(DNS_ADBADDRINFO_VALID(addr));
|
||||
|
||||
REQUIRE(atomic_fetch_sub_release(&addr->entry->active, 1) != 0);
|
||||
active = atomic_fetch_sub_release(&addr->entry->active, 1);
|
||||
INSIST(active != 0);
|
||||
}
|
||||
|
||||
isc_stats_t *
|
||||
|
Reference in New Issue
Block a user