diff --git a/checkin_notes b/checkin_notes index 3f60ff1c0a..3e2613e88c 100644 --- a/checkin_notes +++ b/checkin_notes @@ -6196,3 +6196,22 @@ David 22 Aug 2010 work_fetch.cpp rr_sim.cpp sim.h + +Charlie 23 Aug 2010 + - MGR: Further refinements to Client shutdown logic on Manager Exit: + Old: Manager shut down Client only if it started the Client. + New: + Don't show exit dialog if connected Client is not on localhost. + Mac: Manager shuts down Client only if it started the Client + and if the Client is on localhost. + Windows, Linux: Manager shuts down Client only if the Client is + on localhost and the user requests Client shutdown in the + exit dialog, even if running as a service on Windows. As + before, it skips the exit dialog and uses the saved behavior + if the user previously set "Remember this decision and do not + show this dialog." + + clientgui/ + BOINCClientManager.cpp + BOINCGUIApp.cpp + MainDocument.cpp diff --git a/clientgui/BOINCClientManager.cpp b/clientgui/BOINCClientManager.cpp index 068152e280..38b6b2b016 100644 --- a/clientgui/BOINCClientManager.cpp +++ b/clientgui/BOINCClientManager.cpp @@ -457,60 +457,63 @@ void CBOINCClientManager::ShutdownBOINCCore() { wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); - if (m_bBOINCStartedByManager) { -#ifdef __WXMSW__ - if (IsBOINCConfiguredAsDaemon()) { - stop_daemon_via_daemonctrl(); - bClientQuit = true; - } else +#ifndef __WXMAC__ + // Mac Manager shuts down client only if Manager started client + if (!m_bBOINCStartedByManager) return; #endif - { - pDoc->GetConnectedComputerName(strConnectedCompter); - if (!pDoc->IsComputerNameLocal(strConnectedCompter)) { - RPC_CLIENT rpc; - if (!rpc.init("localhost")) { - pDoc->m_pNetworkConnection->GetLocalPassword(strPassword); - rpc.authorize((const char*)strPassword.mb_str()); - if (IsBOINCCoreRunning()) { - rpc.quit(); - for (iCount = 0; iCount <= 10; iCount++) { - if (!bClientQuit && !IsBOINCCoreRunning()) { - wxLogTrace(wxT("Function Status"), wxT("CBOINCClientManager::ShutdownBOINCCore - (localhost) Application Exit Detected")); - bClientQuit = true; - break; - } - wxLogTrace(wxT("Function Status"), wxT("CBOINCClientManager::ShutdownBOINCCore - (localhost) Application Exit NOT Detected, Sleeping...")); - ::wxSleep(1); - } - } else { - bClientQuit = true; - } - } - rpc.close(); - } else { + +#ifdef __WXMSW__ + if (IsBOINCConfiguredAsDaemon()) { + stop_daemon_via_daemonctrl(); + bClientQuit = true; + } else +#endif + { + pDoc->GetConnectedComputerName(strConnectedCompter); + if (!pDoc->IsComputerNameLocal(strConnectedCompter)) { + RPC_CLIENT rpc; + if (!rpc.init("localhost")) { + pDoc->m_pNetworkConnection->GetLocalPassword(strPassword); + rpc.authorize((const char*)strPassword.mb_str()); if (IsBOINCCoreRunning()) { - pDoc->CoreClientQuit(); + rpc.quit(); for (iCount = 0; iCount <= 10; iCount++) { if (!bClientQuit && !IsBOINCCoreRunning()) { - wxLogTrace(wxT("Function Status"), wxT("CBOINCClientManager::ShutdownBOINCCore - Application Exit Detected")); + wxLogTrace(wxT("Function Status"), wxT("CBOINCClientManager::ShutdownBOINCCore - (localhost) Application Exit Detected")); bClientQuit = true; break; } - wxLogTrace(wxT("Function Status"), wxT("CBOINCClientManager::ShutdownBOINCCore - Application Exit NOT Detected, Sleeping...")); + wxLogTrace(wxT("Function Status"), wxT("CBOINCClientManager::ShutdownBOINCCore - (localhost) Application Exit NOT Detected, Sleeping...")); ::wxSleep(1); } } else { bClientQuit = true; } } + rpc.close(); + } else { + if (IsBOINCCoreRunning()) { + pDoc->CoreClientQuit(); + for (iCount = 0; iCount <= 10; iCount++) { + if (!bClientQuit && !IsBOINCCoreRunning()) { + wxLogTrace(wxT("Function Status"), wxT("CBOINCClientManager::ShutdownBOINCCore - Application Exit Detected")); + bClientQuit = true; + break; + } + wxLogTrace(wxT("Function Status"), wxT("CBOINCClientManager::ShutdownBOINCCore - Application Exit NOT Detected, Sleeping...")); + ::wxSleep(1); + } + } else { + bClientQuit = true; + } } - - if (!bClientQuit) { - KillClient(); - } - m_lBOINCCoreProcessId = 0; } + if (!bClientQuit) { + KillClient(); + } + m_lBOINCCoreProcessId = 0; + wxLogTrace(wxT("Function Start/End"), wxT("CBOINCClientManager::ShutdownBOINCCore - Function End")); } diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index 2268602a2d..af59490f4b 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -997,15 +997,10 @@ int CBOINCGUIApp::ConfirmExit() { wxASSERT(wxDynamicCast(pDoc, CMainDocument)); wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced)); - // If we are connected to the local core client and the manager is exiting - // give the user the option to shutdown the core client, even if the - // manager didn't launch the core client anyway. - if (!pDoc->m_pClientManager->WasBOINCStartedByManager()) { - pDoc->GetConnectedComputerName(strConnectedCompter); - if (!pDoc->IsComputerNameLocal(strConnectedCompter)) { - // Don't shutdown remote clients - return 1; - } + pDoc->GetConnectedComputerName(strConnectedCompter); + if (!pDoc->IsComputerNameLocal(strConnectedCompter)) { + // Don't shut down remote clients on Manager exit + return 1; } // Don't run confirmation dialog if logging out or shutting down Mac, diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index d4d023d001..c2a303e39b 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -509,14 +509,19 @@ int CMainDocument::OnInit() { int CMainDocument::OnExit() { - int iRetVal = 0; + wxString strConnectedCompter = wxEmptyString; + int iRetVal = 0; if (m_pClientManager) { #ifdef __WXMSW__ if (wxGetApp().ShouldShutdownCoreClient()) #endif { - m_pClientManager->ShutdownBOINCCore(); + // Shut down only local clients on Manager exit + GetConnectedComputerName(strConnectedCompter); + if (IsComputerNameLocal(strConnectedCompter)) { + m_pClientManager->ShutdownBOINCCore(); + } } delete m_pClientManager;