From 35688bb8e95e571a953e449691770f46937f7abe Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Thu, 14 May 2009 12:36:09 +0000 Subject: [PATCH] MGR: Update m_dtCachedCCStatusTimestamp only when RPC completes svn path=/trunk/boinc/; revision=18097 --- checkin_notes | 6 ++++++ clientgui/BOINCClientManager.cpp | 18 +++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/checkin_notes b/checkin_notes index 5ce2384fae..e625929127 100644 --- a/checkin_notes +++ b/checkin_notes @@ -4512,3 +4512,9 @@ Charlie 13 May 2009 clientgui/ AsyncRPC.cpp + +Charlie 14 May 2009 + - MGR: Update m_dtCachedCCStatusTimestamp only when RPC completes. + + clientgui/ + MainDocument.cpp diff --git a/clientgui/BOINCClientManager.cpp b/clientgui/BOINCClientManager.cpp index c8552f3302..1c6784331c 100644 --- a/clientgui/BOINCClientManager.cpp +++ b/clientgui/BOINCClientManager.cpp @@ -110,7 +110,6 @@ int CBOINCClientManager::IsBOINCConfiguredAsDaemon() { bool CBOINCClientManager::IsBOINCCoreRunning() { wxLogTrace(wxT("Function Start/End"), wxT("CBOINCClientManager::IsBOINCCoreRunning - Function Begin")); - int retval=0; bool running = false; RPC_CLIENT rpc; @@ -119,7 +118,17 @@ bool CBOINCClientManager::IsBOINCCoreRunning() { if (IsBOINCServiceInstalled()) { running = (FALSE != IsBOINCServiceStarting()) || (FALSE != IsBOINCServiceRunning()); } else { + if (m_hBOINCCoreProcess != NULL) { + if (GetExitCodeProcess(m_hBOINCCoreProcess, &dwExitCode)) { + running = (STILL_ACTIVE == dwExitCode); + } + } +#else + if (m_lBOINCCoreProcessId != 0) { + running = ProcessExists(m_lBOINCCoreProcessId); + } #endif +#if 0 // If set up to run as a daemon, allow time for daemon to start up for (int i=0; i<10; i++) { retval = rpc.init("localhost"); // synchronous is OK since local @@ -137,6 +146,7 @@ bool CBOINCClientManager::IsBOINCCoreRunning() { if (!IsBOINCConfiguredAsDaemon()) break; wxSleep(1); } +#endif #ifdef __WXMSW__ } #endif @@ -405,7 +415,9 @@ bool CBOINCClientManager::ProcessExists(pid_t thePID) char buf[256]; pid_t aPID; - f = popen("ps -a -x -c -o pid,state", "r"); +// f = popen("ps -a -x -c -o pid,state", "r"); + sprintf(buf, "ps -a -x -c -o pid,state -p %d", thePID); + f = popen(buf, "r"); if (f == NULL) return false; @@ -422,7 +434,7 @@ bool CBOINCClientManager::ProcessExists(pid_t thePID) return false; } -// wxProcess::Exists and wxKill are unimplemented in WxMac-2.6.0 +// wxProcess::Exists returns true for zombies and kill(pid, 0) returns OK for zombies void CBOINCClientManager::ShutdownBOINCCore() { CMainDocument* pDoc = wxGetApp().GetDocument(); wxInt32 iCount = 0;