[Manager] Fix an issue when 127.0.0.1 was not recognized as local address

This issue fixes #2746.
It adds an option to recognize '127.0.0.1' as local address.
Also code was reorganized to get rid off multiple strMachine.Lower() function calls.

Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
This commit is contained in:
Vitalii Koshura 2018-10-10 01:43:47 +03:00
parent 650127da84
commit 82528eff5d
No known key found for this signature in database
GPG Key ID: CE0DB1726070A5A3
1 changed files with 18 additions and 7 deletions

View File

@ -265,15 +265,26 @@ bool CNetworkConnection::IsComputerNameLocal(const wxString& strMachine) {
if (strMachine.empty()) {
return true;
} else if (wxT("localhost") == strMachine.Lower()) {
return true;
} else if (wxT("localhost.localdomain") == strMachine.Lower()) {
return true;
} else if (strHostName == strMachine.Lower()) {
return true;
} else if (strFullHostName == strMachine.Lower()) {
}
const wxString& strMachineLower = strMachine.Lower();
if (wxT("localhost") == strMachineLower) {
return true;
}
if (wxT("localhost.localdomain") == strMachineLower) {
return true;
}
if (strHostName == strMachineLower) {
return true;
}
if (strFullHostName == strMachineLower) {
return true;
}
if (wxT("127.0.0.1") == strMachineLower) {
return true;
}
return false;
}