| 1015 | } |
| 1016 | |
| 1017 | void CServerList::CheckForExpiredUDPKeys() { |
| 1018 | |
| 1019 | if (!thePrefs::IsServerCryptLayerUDPEnabled()) { |
| 1020 | return; |
| 1021 | } |
| 1022 | |
| 1023 | uint32 cKeysTotal = 0; |
| 1024 | uint32 cKeysExpired = 0; |
| 1025 | uint32 cPingDelayed = 0; |
| 1026 | const uint32 dwIP = theApp->GetPublicIP(); |
| 1027 | const time_t currentTime = time(NULL); |
| 1028 | wxASSERT( dwIP != 0 ); |
| 1029 | |
| 1030 | for (CInternalList::const_iterator it = m_servers.begin(); it != m_servers.end(); ++it) { |
| 1031 | CServer* pServer = *it; |
| 1032 | if (pServer->SupportsObfuscationUDP() && pServer->GetServerKeyUDP(true) != 0 && pServer->GetServerKeyUDPIP() != dwIP){ |
| 1033 | cKeysTotal++; |
| 1034 | cKeysExpired++; |
| 1035 | if (currentTime < pServer->GetRealLastPingedTime() + UDPSERVSTATMINREASKTIME){ |
| 1036 | cPingDelayed++; |
| 1037 | // next ping: Now + (MinimumDelay - already elapsed time) |
| 1038 | pServer->SetLastPingedTime((currentTime - UDPSERVSTATREASKTIME) + (UDPSERVSTATMINREASKTIME - (currentTime - pServer->GetRealLastPingedTime()))); |
| 1039 | } else { |
| 1040 | pServer->SetLastPingedTime(0); |
| 1041 | } |
| 1042 | } else if (pServer->SupportsObfuscationUDP() && pServer->GetServerKeyUDP(false) != 0) { |
| 1043 | cKeysTotal++; |
| 1044 | } |
| 1045 | } |
| 1046 | } |
| 1047 | // File_checked_for_headers |
no test coverage detected