MCPcopy Create free account
hub / github.com/amule-project/amule / CheckForExpiredUDPKeys

Method CheckForExpiredUDPKeys

src/ServerList.cpp:1017–1046  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1015}
1016
1017void 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

Callers 1

SetPublicIPMethod · 0.80

Calls 8

GetServerKeyUDPMethod · 0.80
GetServerKeyUDPIPMethod · 0.80
GetRealLastPingedTimeMethod · 0.80
SetLastPingedTimeMethod · 0.80
GetPublicIPMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected