This function is left as a reminder. Changes here _must_ be reflected in CClientList::FindMatchingClient.
| 56 | // This function is left as a reminder. |
| 57 | // Changes here _must_ be reflected in CClientList::FindMatchingClient. |
| 58 | bool CUpDownClient::Compare(const CUpDownClient* tocomp, bool bIgnoreUserhash) const |
| 59 | { |
| 60 | if (!tocomp) { |
| 61 | // should we wxASSERT here? |
| 62 | return false; |
| 63 | } |
| 64 | |
| 65 | //Compare only the user hash.. |
| 66 | if(!bIgnoreUserhash && HasValidHash() && tocomp->HasValidHash()) { |
| 67 | return GetUserHash() == tocomp->GetUserHash(); |
| 68 | } |
| 69 | |
| 70 | if (HasLowID()) { |
| 71 | //User is firewalled.. Must do two checks.. |
| 72 | if (GetIP()!=0 && GetIP() == tocomp->GetIP()) { |
| 73 | //The IP of both match |
| 74 | if (GetUserPort()!=0 && GetUserPort() == tocomp->GetUserPort()) { |
| 75 | //IP-UserPort matches |
| 76 | return true; |
| 77 | } |
| 78 | if (GetKadPort()!=0 && GetKadPort() == tocomp->GetKadPort()) { |
| 79 | //IP-KadPort Matches |
| 80 | return true; |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | if (GetUserIDHybrid()!=0 |
| 85 | && GetUserIDHybrid() == tocomp->GetUserIDHybrid() |
| 86 | && GetServerIP()!=0 |
| 87 | && GetServerIP() == tocomp->GetServerIP() |
| 88 | && GetServerPort()!=0 |
| 89 | && GetServerPort() == tocomp->GetServerPort()) { |
| 90 | //Both have the same lowID, Same serverIP and Port.. |
| 91 | return true; |
| 92 | } |
| 93 | |
| 94 | //Both IP, and Server do not match.. |
| 95 | return false; |
| 96 | } |
| 97 | |
| 98 | //User is not firewalled. |
| 99 | if (GetUserPort()!=0) { |
| 100 | //User has a Port, lets check the rest. |
| 101 | if (GetIP() != 0 && tocomp->GetIP() != 0) { |
| 102 | //Both clients have a verified IP.. |
| 103 | if(GetIP() == tocomp->GetIP() && GetUserPort() == tocomp->GetUserPort()) { |
| 104 | //IP and UserPort match.. |
| 105 | return true; |
| 106 | } |
| 107 | } else { |
| 108 | //One of the two clients do not have a verified IP |
| 109 | if (GetUserIDHybrid() == tocomp->GetUserIDHybrid() && GetUserPort() == tocomp->GetUserPort()) { |
| 110 | //ID and Port Match.. |
| 111 | return true; |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 |
nothing calls this directly
no test coverage detected