Merge pull request #2745 from AenBleidd/fix_need_run_daemon

NeedRunDaemon option should be applied when connecting to localhost o…
This commit is contained in:
Juha Sointusalo 2018-11-04 00:06:28 +02:00 committed by GitHub
commit 03e37da9c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 11 deletions

View File

@ -599,17 +599,16 @@ int CMainDocument::OnPoll() {
} }
} }
if (wxGetApp().GetNeedRunDaemon()) { if (wxGetApp().GetNeedRunDaemon() && IsComputerNameLocal(hostName)) {
if (IsComputerNameLocal(hostName)) { if (m_pClientManager->StartupBOINCCore()) {
if (m_pClientManager->StartupBOINCCore()) { Connect(wxT("localhost"), portNum, password, TRUE, TRUE);
Connect(wxT("localhost"), portNum, password, TRUE, TRUE);
} else {
m_pNetworkConnection->ForceDisconnect();
pFrame->ShowDaemonStartFailedAlert();
}
} else {
Connect(hostName, portNum, password, TRUE, password.IsEmpty());
} }
else {
m_pNetworkConnection->ForceDisconnect();
pFrame->ShowDaemonStartFailedAlert();
}
} else {
Connect(hostName, portNum, password, TRUE, password.IsEmpty());
} }
} }
@ -663,7 +662,7 @@ int CMainDocument::ResetState() {
int CMainDocument::Connect(const wxString& szComputer, int iPort, const wxString& szComputerPassword, const bool bDisconnect, const bool bUseDefaultPassword) { int CMainDocument::Connect(const wxString& szComputer, int iPort, const wxString& szComputerPassword, const bool bDisconnect, const bool bUseDefaultPassword) {
if (IsComputerNameLocal(szComputer)) { if (wxGetApp().GetNeedRunDaemon() && IsComputerNameLocal(szComputer)) {
// Restart client if not already running // Restart client if not already running
m_pClientManager->AutoRestart(); m_pClientManager->AutoRestart();
} }