本文整理汇总了C++中LLCircuitData::updateWatchDogTimers方法的典型用法代码示例。如果您正苦于以下问题:C++ LLCircuitData::updateWatchDogTimers方法的具体用法?C++ LLCircuitData::updateWatchDogTimers怎么用?C++ LLCircuitData::updateWatchDogTimers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLCircuitData
的用法示例。
在下文中一共展示了LLCircuitData::updateWatchDogTimers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateWatchDogTimers
void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys)
{
F64 cur_time = LLMessageSystem::getMessageTimeSeconds();
S32 count = mPingSet.size();
S32 cur = 0;
// Only process each circuit once at most, stop processing if no circuits
while((cur < count) && !mPingSet.empty())
{
cur++;
LLCircuit::ping_set_t::iterator psit = mPingSet.begin();
LLCircuitData *cdp = *psit;
if (!cdp->mbAlive)
{
// We suspect that this case should never happen, given how
// the alive status is set.
// Skip over dead circuits, just add the ping interval and push it to the back
// Always remember to remove it from the set before changing the sorting
// key (mNextPingSendTime)
mPingSet.erase(psit);
cdp->mNextPingSendTime = cur_time + PING_INTERVAL;
mPingSet.insert(cdp);
continue;
}
else
{
// Check to see if this needs a ping
if (cur_time < cdp->mNextPingSendTime)
{
// This circuit doesn't need a ping, break out because
// we have a sorted list, thus no more circuits need pings
break;
}
// Update watchdog timers
if (cdp->updateWatchDogTimers(msgsys))
{
// Randomize our pings a bit by doing some up to 5% early or late
F64 dt = 0.95f*PING_INTERVAL + ll_frand(0.1f*PING_INTERVAL);
// Remove it, and reinsert it with the new next ping time.
// Always remove before changing the sorting key.
mPingSet.erase(psit);
cdp->mNextPingSendTime = cur_time + dt;
mPingSet.insert(cdp);
// Update our throttles
cdp->mThrottles.dynamicAdjust();
// Update some stats, this is not terribly important
cdp->checkPeriodTime();
}
else
{
// This mPingSet.erase isn't necessary, because removing the circuit will
// remove the ping set.
//mPingSet.erase(psit);
removeCircuitData(cdp->mHost);
}
}
}
}