From ace6f7f4685a4a8bb09dbe70421d2ffab0ee8277 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Fri, 16 Jul 2010 08:26:16 +0000 Subject: [PATCH] MGR: Fix SimpleView bug I introduced; better way to prevent a race condition which erroneously shows Attach Wizard when restarting the client svn path=/trunk/boinc/; revision=21967 --- checkin_notes | 8 ++++++++ clientgui/MainDocument.cpp | 26 ++++++++++++++------------ clientgui/MainDocument.h | 2 +- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/checkin_notes b/checkin_notes index caa3a71ba8..9beeb621a2 100644 --- a/checkin_notes +++ b/checkin_notes @@ -5179,3 +5179,11 @@ Bernd 15 July 2010 validator.cpp assimilator.cpp +Charlie 16 Jul 2010 + - MGR: Better solution to prevent a race condition which could erroneously + invoke the Attach Wizard when restarting the client, fix serious bug + in Simple View I introduced with my previous fix if 14 July. + + clientgui/ + AdvancedFrame.cpp + MainDocument.cpp diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 23598c7171..075cae962d 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -337,9 +337,6 @@ void CNetworkConnection::SetStateSuccess(wxString& strComputer, wxString& strCom CBOINCBaseFrame* pFrame = wxGetApp().GetFrame(); if (pFrame && !m_bFrameShutdownDetected) { wxASSERT(wxDynamicCast(pFrame, CBOINCBaseFrame)); - // Prevent a race condition where OnFrameRender() causes SetStateDisconnected() - // to be called due to a previous RPC error before we reconnected. - pFrame->StopTimers(); m_bConnected = true; m_bReconnecting = false; @@ -350,6 +347,10 @@ void CNetworkConnection::SetStateSuccess(wxString& strComputer, wxString& strCom m_strNewComputerPassword = wxEmptyString; m_bNewConnection = false; + // Prevent a race condition where OnFrameRender() causes SetStateDisconnected() + // to be called due to a previous RPC error before we reconnected. + m_pDocument->RefreshRPCs(true); + // Get the version of the client and cache it VERSION_INFO vi; m_pDocument->rpc.exchange_versions(vi); @@ -798,48 +799,49 @@ int CMainDocument::SetNetworkRunMode(int iMode, int iTimeout) { // We use 0 to indicate that the RPC has never been called yet, so // set last update time to (time_t)1 here rather than to (time_t)0, // and only if it is currently not zero. -void CMainDocument::RefreshRPCs() { +void CMainDocument::RefreshRPCs(bool fullReset) { + wxDateTime t = fullReset ? wxDateTime((time_t)0) : wxDateTime((time_t)1); if (!m_dtCachedCCStatusTimestamp.IsEqualTo(wxDateTime((time_t)0))) { - m_dtCachedCCStatusTimestamp = wxDateTime((time_t)1); + m_dtCachedCCStatusTimestamp = t; // m_iGet_status_rpc_result = -1; } if (!m_dtProjectsStatusTimestamp.IsEqualTo(wxDateTime((time_t)0))) { - m_dtProjectsStatusTimestamp = wxDateTime((time_t)1); + m_dtProjectsStatusTimestamp = t; // m_iGet_project_status1_rpc_result = -1; } if (!m_dtResultsTimestamp.IsEqualTo(wxDateTime((time_t)0))) { - m_dtResultsTimestamp = wxDateTime((time_t)1); + m_dtResultsTimestamp = t; // m_iGet_results_rpc_result = -1; } m_fResultsRPCExecutionTime = 0; if (!m_dtFileTransfersTimestamp.IsEqualTo(wxDateTime((time_t)0))) { - m_dtFileTransfersTimestamp = wxDateTime((time_t)1); + m_dtFileTransfersTimestamp = t; // m_iGet_file_transfers_rpc_result = 0; } // m_iGet_messages_rpc_result = -1; if (!m_dtDiskUsageTimestamp.IsEqualTo(wxDateTime((time_t)0))) { - m_dtDiskUsageTimestamp = wxDateTime((time_t)1); + m_dtDiskUsageTimestamp = t; // m_iGet_dsk_usage_rpc_result = -1; } if (!m_dtStatisticsStatusTimestamp.IsEqualTo(wxDateTime((time_t)0))) { - m_dtStatisticsStatusTimestamp = wxDateTime((time_t)1); + m_dtStatisticsStatusTimestamp = t; // m_iGet_statistics_rpc_result = -1; } if (!m_dtCachedSimpleGUITimestamp.IsEqualTo(wxDateTime((time_t)0))) { - m_dtCachedSimpleGUITimestamp = wxDateTime((time_t)1); + m_dtCachedSimpleGUITimestamp = t; // m_iGet_simple_gui2_rpc_result = -1; } if (!m_dtCachedAcctMgrInfoTimestamp.IsEqualTo(wxDateTime((time_t)0))) { - m_dtCachedAcctMgrInfoTimestamp = wxDateTime((time_t)1); + m_dtCachedAcctMgrInfoTimestamp = t; m_iAcct_mgr_info_rpc_result = -1; } diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h index 57b1ffe668..e476981d5e 100644 --- a/clientgui/MainDocument.h +++ b/clientgui/MainDocument.h @@ -161,7 +161,7 @@ public: int SetGPURunMode(int iMode, int iTimeout); int SetNetworkRunMode(int iMode, int iTimeout); - void RefreshRPCs(); + void RefreshRPCs(bool fullReset = false); void RunPeriodicRPCs(int frameRefreshRate); int ForceCacheUpdate(bool immediate = true); int RunBenchmarks();