mirror of https://github.com/BOINC/boinc.git
- MGR: Cache the local computer name in statics to avoid functions
that take awhile to execute. clientgui/ MainDocument.cpp svn path=/trunk/boinc/; revision=14686
This commit is contained in:
parent
d70d9f0183
commit
b0869fb768
|
@ -1210,3 +1210,10 @@ David Feb 5 2008
|
|||
clientgui/
|
||||
BOINCBaseFrame.cpp
|
||||
MainDocument.cpp
|
||||
|
||||
Rom Feb 5 2008
|
||||
- MGR: Cache the local computer name in statics to avoid functions
|
||||
that take awhile to execute.
|
||||
|
||||
clientgui/
|
||||
MainDocument.cpp
|
||||
|
|
|
@ -198,15 +198,25 @@ int CNetworkConnection::GetConnectingComputerName(wxString& strMachine) {
|
|||
|
||||
|
||||
bool CNetworkConnection::IsComputerNameLocal(const wxString& strMachine) {
|
||||
static wxString strHostName = wxEmptyString;
|
||||
static wxString strFullHostName = wxEmptyString;
|
||||
|
||||
if (strHostName.empty()) {
|
||||
strHostName = ::wxGetHostName().Lower();
|
||||
}
|
||||
if (strFullHostName.empty()) {
|
||||
strFullHostName = ::wxGetFullHostName().Lower();
|
||||
}
|
||||
|
||||
if (strMachine.empty()) {
|
||||
return true;
|
||||
} else if (wxT("localhost") == strMachine.Lower()) {
|
||||
return true;
|
||||
} else if (wxT("localhost.localdomain") == strMachine.Lower()) {
|
||||
return true;
|
||||
} else if (::wxGetHostName().Lower() == strMachine.Lower()) {
|
||||
} else if (strHostName == strMachine.Lower()) {
|
||||
return true;
|
||||
} else if (::wxGetFullHostName().Lower() == strMachine.Lower()) {
|
||||
} else if (strFullHostName == strMachine.Lower()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue