[Manager] Fix connection to second local client instance

Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
This commit is contained in:
Vitalii Koshura 2019-10-25 09:57:37 +02:00
parent b7b35af9aa
commit fd1e7a3ec0
No known key found for this signature in database
GPG Key ID: CE0DB1726070A5A3
3 changed files with 7 additions and 2 deletions

View File

@ -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"))) {

View File

@ -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();

View File

@ -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();