Mgr: Don't call get_notices RPC before previous one is processed to prevent multiple display of notices

This commit is contained in:
Charlie Fenton 2012-12-20 03:55:33 -08:00 committed by Oliver Bock
parent b05771cfc1
commit 67e25bacaf
3 changed files with 26 additions and 13 deletions

View File

@ -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

View File

@ -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 = &notices;
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 = &notices;
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)) {

View File

@ -284,6 +284,7 @@ private:
int m_iNoticeSequenceNumber;
int m_iLastReadNoticeSequenceNumber;
double m_dLastReadNoticeArrivalTime;
bool m_bWaitingForGetNoticesRPC;
public:
NOTICES notices;