| 475 | } |
| 476 | |
| 477 | void NetInterface::checkTimeouts() |
| 478 | { |
| 479 | U32 time = Platform::getVirtualMilliseconds(); |
| 480 | if(time > mLastTimeoutCheckTime + TimeoutCheckInterval) |
| 481 | { |
| 482 | for(U32 i = 0; i < mPendingConnections.size();) |
| 483 | { |
| 484 | NetConnection *pending = mPendingConnections[i]; |
| 485 | |
| 486 | if(pending->getConnectionState() == NetConnection::AwaitingChallengeResponse && |
| 487 | time > pending->mConnectLastSendTime + ChallengeRetryTime) |
| 488 | { |
| 489 | if(pending->mConnectSendCount > ChallengeRetryCount) |
| 490 | { |
| 491 | pending->onConnectTimedOut(); |
| 492 | removePendingConnection(pending); |
| 493 | pending->deleteObject(); |
| 494 | continue; |
| 495 | } |
| 496 | else |
| 497 | sendConnectChallengeRequest(pending); |
| 498 | } |
| 499 | else if(pending->getConnectionState() == NetConnection::AwaitingConnectResponse && |
| 500 | time > pending->mConnectLastSendTime + ConnectRetryTime) |
| 501 | { |
| 502 | if(pending->mConnectSendCount > ConnectRetryCount) |
| 503 | { |
| 504 | pending->onConnectTimedOut(); |
| 505 | removePendingConnection(pending); |
| 506 | pending->deleteObject(); |
| 507 | continue; |
| 508 | } |
| 509 | else |
| 510 | sendConnectRequest(pending); |
| 511 | } |
| 512 | i++; |
| 513 | } |
| 514 | mLastTimeoutCheckTime = time; |
| 515 | NetConnection *walk = NetConnection::getConnectionList(); |
| 516 | |
| 517 | while(walk) |
| 518 | { |
| 519 | NetConnection *next = walk->getNext(); |
| 520 | if(walk->checkTimeout(time)) |
| 521 | { |
| 522 | // this baddie timed out |
| 523 | walk->onTimedOut(); |
| 524 | walk->deleteObject(); |
| 525 | } |
| 526 | walk = next; |
| 527 | } |
| 528 | } |
| 529 | } |
| 530 | |
| 531 | #define F1(x, y, z) (z ^ (x & (y ^ z))) |
| 532 | #define F2(x, y, z) F1(z, x, y) |
no test coverage detected