From 67e25bacaf7665b84d2fb88d0ed28cad65b0e064 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Thu, 20 Dec 2012 03:55:33 -0800 Subject: [PATCH] Mgr: Don't call get_notices RPC before previous one is processed to prevent multiple display of notices --- checkin_notes | 5 +++++ clientgui/MainDocument.cpp | 33 ++++++++++++++++++++------------- clientgui/MainDocument.h | 1 + 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/checkin_notes b/checkin_notes index d6b5df214b..4855dd80ce 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7801,6 +7801,11 @@ Charlie 20 Dec 2012 connection so use a shorter timeout for subsequent calls to OpenURL until one succeeds; otherwise notices takes takes too long to display if there are multiple notices with images. + - Mgr: Display the fetching notices message until we have notices to + display or have determined that there are no notices. + - Mgr: Don't call get_notices RPC before previous one is processed to + prevent multiple display of notices. clientgui/ + MainDocument.cpp,.h BOINCInternetFSHandler.cpp diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 834eaeae49..46fea834eb 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -407,6 +407,7 @@ CMainDocument::CMainDocument() : rpc(this) { m_iNoticeSequenceNumber = 0; m_iLastReadNoticeSequenceNumber = -1; m_dLastReadNoticeArrivalTime = 0.0; + m_bWaitingForGetNoticesRPC = false; m_dtCachedStateTimestamp = wxDateTime((time_t)0); m_iGet_state_rpc_result = 0; @@ -972,18 +973,23 @@ void CMainDocument::RunPeriodicRPCs(int frameRefreshRate) { ts = dtNow - m_dtNoticesTimeStamp; if ((currentTabView & VW_NOTIF) || (ts.GetSeconds() >= NOTICESBACKGROUNDRPC_INTERVAL)) { - - request.clear(); - request.which_rpc = RPC_GET_NOTICES; - // m_iNoticeSequenceNumber could change between request and execution - // of RPC, so pass in a pointer rather than its value - request.arg1 = &m_iNoticeSequenceNumber; - request.arg2 = ¬ices; - request.rpcType = RPC_TYPE_ASYNC_WITH_REFRESH_AFTER; - request.completionTime = &m_dtNoticesTimeStamp; - request.resultPtr = &m_iGet_notices_rpc_result; - - RequestRPC(request); + // Don't request another get_notices RPC until we have + // updated m_iNoticeSequenceNumber from the previous + // one; otherwise we will get duplicate notices + if (!m_bWaitingForGetNoticesRPC) { + m_bWaitingForGetNoticesRPC = true; + request.clear(); + request.which_rpc = RPC_GET_NOTICES; + // m_iNoticeSequenceNumber could change between request and execution + // of RPC, so pass in a pointer rather than its value + request.arg1 = &m_iNoticeSequenceNumber; + request.arg2 = ¬ices; + request.rpcType = RPC_TYPE_ASYNC_WITH_REFRESH_AFTER; + request.completionTime = &m_dtNoticesTimeStamp; + request.resultPtr = &m_iGet_notices_rpc_result; + + RequestRPC(request); + } } ts = dtNow - m_dtCachedStateTimestamp; @@ -1834,7 +1840,8 @@ int CMainDocument::CachedNoticeUpdate() { if (in_this_func) return 0; in_this_func = true; - + m_bWaitingForGetNoticesRPC = false; + if (IsConnected()) { // Can't look up previous last read message until we know machine name if (!strlen(state.host_info.domain_name)) { diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h index 8ba380c276..edb5c4a436 100644 --- a/clientgui/MainDocument.h +++ b/clientgui/MainDocument.h @@ -284,6 +284,7 @@ private: int m_iNoticeSequenceNumber; int m_iLastReadNoticeSequenceNumber; double m_dLastReadNoticeArrivalTime; + bool m_bWaitingForGetNoticesRPC; public: NOTICES notices;