mirror of https://github.com/BOINC/boinc.git
MGR: Further refinements to Client shutdown logic on Manager Exit
svn path=/trunk/boinc/; revision=22287
This commit is contained in:
parent
fdf15fb3af
commit
7c032fe498
|
@ -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
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue