From 82528eff5dc22072e835b0b3b5878513f82a6306 Mon Sep 17 00:00:00 2001 From: Vitalii Koshura Date: Wed, 10 Oct 2018 01:43:47 +0300 Subject: [PATCH] [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 --- clientgui/MainDocument.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 12abdfed93..f8d8bae5be 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -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; }