From fd1e7a3ec0d433632a486f2f2cd3a6b33ae6641f Mon Sep 17 00:00:00 2001 From: Vitalii Koshura Date: Fri, 25 Oct 2019 09:57:37 +0200 Subject: [PATCH] [Manager] Fix connection to second local client instance Signed-off-by: Vitalii Koshura --- clientgui/BOINCGUIApp.cpp | 2 ++ clientgui/BOINCGUIApp.h | 2 ++ clientgui/MainDocument.cpp | 5 +++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index 49e3d9e8da..f7ae21b934 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -104,6 +104,7 @@ bool CBOINCGUIApp::OnInit() { m_bGUIVisible = true; m_bDebugSkins = false; m_bMultipleInstancesOK = false; + m_bHostnamePasswordSet = false; m_bBOINCMGRAutoStarted = false; m_iBOINCMGRDisableAutoStart = 0; m_iShutdownCoreClient = 0; @@ -690,6 +691,7 @@ bool CBOINCGUIApp::OnCmdLineParsed(wxCmdLineParser &parser) { if (hostNameSpecified && passwordSpecified) { m_bMultipleInstancesOK = true; + m_bHostnamePasswordSet = true; } if (parser.Found(wxT("no-daemon"))) { diff --git a/clientgui/BOINCGUIApp.h b/clientgui/BOINCGUIApp.h index dc2aa252f0..782f606860 100644 --- a/clientgui/BOINCGUIApp.h +++ b/clientgui/BOINCGUIApp.h @@ -108,6 +108,7 @@ protected: int m_iGUISelected; bool m_bDebugSkins; bool m_bMultipleInstancesOK; + bool m_bHostnamePasswordSet; bool m_bFilterEvents; bool m_bAboutDialogIsOpen; bool m_bRunDaemon; @@ -143,6 +144,7 @@ public: bool IsAnotherInstanceRunning() { return m_pInstanceChecker->IsAnotherRunning(); } bool IsMgrMultipleInstance() { return m_bMultipleInstancesOK; } + bool IsHostnamePasswordSet() { return m_bHostnamePasswordSet; } #ifdef __WXMAC__ void OnFinishInit(); diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 396947e2ff..1b0b00cf80 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -583,6 +583,7 @@ int CMainDocument::OnPoll() { int iRetVal = 0; wxString hostName = wxGetApp().GetClientHostNameArg(); wxString password = wxGetApp().GetClientPasswordArg(); + bool isHostnamePasswordSet = wxGetApp().IsHostnamePasswordSet(); int portNum = wxGetApp().GetClientRPCPortArg(); wxASSERT(wxDynamicCast(m_pClientManager, CBOINCClientManager)); @@ -592,7 +593,7 @@ int CMainDocument::OnPoll() { m_bClientStartCheckCompleted = true; if (IsComputerNameLocal(hostName)) { - if (wxGetApp().IsAnotherInstanceRunning()) { + if (wxGetApp().IsAnotherInstanceRunning() && !isHostnamePasswordSet) { if (!pFrame->SelectComputer(hostName, portNum, password, true)) { s_bSkipExitConfirmation = true; wxCommandEvent event; @@ -603,7 +604,7 @@ int CMainDocument::OnPoll() { if (wxGetApp().GetNeedRunDaemon() && IsComputerNameLocal(hostName)) { if (m_pClientManager->StartupBOINCCore()) { - Connect(wxT("localhost"), portNum, password, TRUE, TRUE); + Connect(wxT("localhost"), portNum, password, TRUE, password.IsEmpty()); } else { m_pNetworkConnection->ForceDisconnect();