}
IDState(const IDState& orig) = delete;
- IDState(IDState&& rhs)
+ IDState(IDState&& rhs) noexcept: internal(std::move(rhs.internal))
{
inUse.store(rhs.inUse.load());
age.store(rhs.age.load());
- internal = std::move(rhs.internal);
}
- IDState& operator=(IDState&& rhs)
+ IDState& operator=(IDState&& rhs) noexcept
{
inUse.store(rhs.inUse.load());
age.store(rhs.age.load());
bool isInUse() const
{
- return inUse == true;
+ return inUse;
}
/* For performance reasons we don't want to use a lock here, but that means
}
do {
- IDState* ids = nullptr;
uint16_t selectedID = (idOffset++) % idStates.size();
- ids = &idStates[selectedID];
- auto guard = ids->acquire();
+ IDState& ids = idStates[selectedID];
+ auto guard = ids.acquire();
if (!guard) {
continue;
}
- if (ids->isInUse()) {
+ if (ids.isInUse()) {
/* we are reusing a state, no change in outstanding but if there was an existing DOHUnit we need
to handle it because it's about to be overwritten. */
- auto oldDU = std::move(ids->internal.du);
+ auto oldDU = std::move(ids.internal.du);
++reuseds;
++g_stats.downstreamTimeouts;
handleDOHTimeout(std::move(oldDU));
else {
++outstanding;
}
- ids->internal = std::move(state);
- ids->age.store(0);
- ids->inUse = true;
+ ids.internal = std::move(state);
+ ids.age.store(0);
+ ids.inUse = true;
return selectedID;
}
while (true);