本文整理汇总了C++中NetConnection::onTimedOut方法的典型用法代码示例。如果您正苦于以下问题:C++ NetConnection::onTimedOut方法的具体用法?C++ NetConnection::onTimedOut怎么用?C++ NetConnection::onTimedOut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetConnection
的用法示例。
在下文中一共展示了NetConnection::onTimedOut方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkTimeouts
void NetInterface::checkTimeouts()
{
U32 time = Platform::getVirtualMilliseconds();
if(time > mLastTimeoutCheckTime + TimeoutCheckInterval)
{
for(U32 i = 0; i < mPendingConnections.size();)
{
NetConnection *pending = mPendingConnections[i];
if(pending->getConnectionState() == NetConnection::AwaitingChallengeResponse &&
time > pending->mConnectLastSendTime + ChallengeRetryTime)
{
if(pending->mConnectSendCount > ChallengeRetryCount)
{
pending->onConnectTimedOut();
removePendingConnection(pending);
pending->deleteObject();
continue;
}
else
sendConnectChallengeRequest(pending);
}
else if(pending->getConnectionState() == NetConnection::AwaitingConnectResponse &&
time > pending->mConnectLastSendTime + ConnectRetryTime)
{
if(pending->mConnectSendCount > ConnectRetryCount)
{
pending->onConnectTimedOut();
removePendingConnection(pending);
pending->deleteObject();
continue;
}
else
sendConnectRequest(pending);
}
i++;
}
mLastTimeoutCheckTime = time;
NetConnection *walk = NetConnection::getConnectionList();
while(walk)
{
NetConnection *next = walk->getNext();
if(walk->checkTimeout(time))
{
// this baddie timed out
walk->onTimedOut();
walk->deleteObject();
}
walk = next;
}
}
}