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