mirror of https://github.com/BOINC/boinc.git
MGR: async GUI RPCs: All periodic RPCs for Advanced View implemented.
svn path=/workspaces/charlief/; revision=15695
This commit is contained in:
parent
4e64023aef
commit
19c81a4ef5
|
@ -6042,7 +6042,7 @@ David 25 July 2008
|
||||||
assimilator.C
|
assimilator.C
|
||||||
tools/
|
tools/
|
||||||
pymw_setup
|
pymw_setup
|
||||||
|
|
||||||
Charlie 25 July 2008
|
Charlie 25 July 2008
|
||||||
- MGR: async GUI RPCs: Implement first Periodic RPCs called
|
- MGR: async GUI RPCs: Implement first Periodic RPCs called
|
||||||
from a timer event for CachedStateUpdate(), ForceCacheUpdate(),
|
from a timer event for CachedStateUpdate(), ForceCacheUpdate(),
|
||||||
|
@ -6055,6 +6055,12 @@ Charlie 25 July 2008
|
||||||
Events.h
|
Events.h
|
||||||
MainDocument.cpp,.h
|
MainDocument.cpp,.h
|
||||||
|
|
||||||
|
David 25 July 2008
|
||||||
|
- web: escape text on edit thread title
|
||||||
|
|
||||||
|
html/user/
|
||||||
|
forum_moderate_thread_action.php
|
||||||
|
|
||||||
Charlie 26 July 2008
|
Charlie 26 July 2008
|
||||||
- MGR: async GUI RPCs: Simulate handling of CRPCFinishedEvent but
|
- MGR: async GUI RPCs: Simulate handling of CRPCFinishedEvent but
|
||||||
don't allow any other events (so allow no user activity) while
|
don't allow any other events (so allow no user activity) while
|
||||||
|
@ -6081,3 +6087,21 @@ Charlie 26 July 2008
|
||||||
mac_build/
|
mac_build/
|
||||||
boinc.xcodeproj/
|
boinc.xcodeproj/
|
||||||
project.pbxproj
|
project.pbxproj
|
||||||
|
|
||||||
|
David 27 July 2008
|
||||||
|
- API: small additions to graphics stderr messages
|
||||||
|
|
||||||
|
api/
|
||||||
|
graphics2.h
|
||||||
|
graphics2_unix.C
|
||||||
|
graphics2_win.C
|
||||||
|
|
||||||
|
Charlie 28 July 2008
|
||||||
|
- MGR: async GUI RPCs: All periodic RPCs for Advanced View implemented.
|
||||||
|
|
||||||
|
clientgui/
|
||||||
|
AdvancedFrame.cpp,.h
|
||||||
|
AsyncRPC.cpp
|
||||||
|
BOINCBaseView.cpp
|
||||||
|
BOINCBaseFrame.cpp,h
|
||||||
|
MainDocument.cpp,.h
|
||||||
|
|
|
@ -186,9 +186,11 @@ BEGIN_EVENT_TABLE (CAdvancedFrame, CBOINCBaseFrame)
|
||||||
EVT_FRAME_REFRESH(CAdvancedFrame::OnRefreshView)
|
EVT_FRAME_REFRESH(CAdvancedFrame::OnRefreshView)
|
||||||
EVT_FRAME_CONNECT(CAdvancedFrame::OnConnect)
|
EVT_FRAME_CONNECT(CAdvancedFrame::OnConnect)
|
||||||
EVT_FRAME_UPDATESTATUS(CAdvancedFrame::OnUpdateStatus)
|
EVT_FRAME_UPDATESTATUS(CAdvancedFrame::OnUpdateStatus)
|
||||||
|
EVT_FRAME_UPDATEMESSAGES(CAdvancedFrame::OnUpdateMessages)
|
||||||
EVT_TIMER(ID_REFRESHSTATETIMER, CAdvancedFrame::OnRefreshState)
|
EVT_TIMER(ID_REFRESHSTATETIMER, CAdvancedFrame::OnRefreshState)
|
||||||
EVT_TIMER(ID_FRAMERENDERTIMER, CAdvancedFrame::OnFrameRender)
|
EVT_TIMER(ID_FRAMERENDERTIMER, CAdvancedFrame::OnFrameRender)
|
||||||
EVT_TIMER(ID_FRAMELISTRENDERTIMER, CAdvancedFrame::OnListPanelRender)
|
// TODO: Remove ID_FRAMELISTRENDERTIMER and all related code
|
||||||
|
// EVT_TIMER(ID_FRAMELISTRENDERTIMER, CAdvancedFrame::OnListPanelRender)
|
||||||
EVT_NOTEBOOK_PAGE_CHANGED(ID_FRAMENOTEBOOK, CAdvancedFrame::OnNotebookSelectionChanged)
|
EVT_NOTEBOOK_PAGE_CHANGED(ID_FRAMENOTEBOOK, CAdvancedFrame::OnNotebookSelectionChanged)
|
||||||
END_EVENT_TABLE ()
|
END_EVENT_TABLE ()
|
||||||
|
|
||||||
|
@ -237,12 +239,12 @@ CAdvancedFrame::CAdvancedFrame(wxString title, wxIcon* icon, wxIcon* icon32) :
|
||||||
m_pFrameRenderTimer = new wxTimer(this, ID_FRAMERENDERTIMER);
|
m_pFrameRenderTimer = new wxTimer(this, ID_FRAMERENDERTIMER);
|
||||||
wxASSERT(m_pFrameRenderTimer);
|
wxASSERT(m_pFrameRenderTimer);
|
||||||
|
|
||||||
m_pFrameListPanelRenderTimer = new wxTimer(this, ID_FRAMELISTRENDERTIMER);
|
// m_pFrameListPanelRenderTimer = new wxTimer(this, ID_FRAMELISTRENDERTIMER); // CAF
|
||||||
wxASSERT(m_pFrameListPanelRenderTimer);
|
// wxASSERT(m_pFrameListPanelRenderTimer);
|
||||||
|
|
||||||
m_pRefreshStateTimer->Start(300000); // Send event every 5 minutes
|
m_pRefreshStateTimer->Start(300000); // Send event every 5 minutes
|
||||||
m_pFrameRenderTimer->Start(1000); // Send event every 1 second
|
m_pFrameRenderTimer->Start(1000); // Send event every 1 second
|
||||||
m_pFrameListPanelRenderTimer->Start(1000); // Send event every 1 second
|
// m_pFrameListPanelRenderTimer->Start(1000); // Send event every 1 second
|
||||||
|
|
||||||
// Limit the number of times the UI can update itself to two times a second
|
// Limit the number of times the UI can update itself to two times a second
|
||||||
// NOTE: Linux and Mac were updating several times a second and eating
|
// NOTE: Linux and Mac were updating several times a second and eating
|
||||||
|
@ -258,7 +260,7 @@ CAdvancedFrame::~CAdvancedFrame() {
|
||||||
|
|
||||||
wxASSERT(m_pRefreshStateTimer);
|
wxASSERT(m_pRefreshStateTimer);
|
||||||
wxASSERT(m_pFrameRenderTimer);
|
wxASSERT(m_pFrameRenderTimer);
|
||||||
wxASSERT(m_pFrameListPanelRenderTimer);
|
// wxASSERT(m_pFrameListPanelRenderTimer);
|
||||||
wxASSERT(m_pMenubar);
|
wxASSERT(m_pMenubar);
|
||||||
wxASSERT(m_pNotebook);
|
wxASSERT(m_pNotebook);
|
||||||
wxASSERT(m_pStatusbar);
|
wxASSERT(m_pStatusbar);
|
||||||
|
@ -278,11 +280,11 @@ CAdvancedFrame::~CAdvancedFrame() {
|
||||||
m_pFrameRenderTimer = NULL;
|
m_pFrameRenderTimer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pFrameListPanelRenderTimer) {
|
// if (m_pFrameListPanelRenderTimer) {
|
||||||
m_pFrameListPanelRenderTimer->Stop();
|
// m_pFrameListPanelRenderTimer->Stop();
|
||||||
delete m_pFrameListPanelRenderTimer;
|
// delete m_pFrameListPanelRenderTimer;
|
||||||
m_pFrameListPanelRenderTimer = NULL;
|
// m_pFrameListPanelRenderTimer = NULL;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (m_pStatusbar)
|
if (m_pStatusbar)
|
||||||
wxCHECK_RET(DeleteStatusbar(), _T("Failed to delete status bar."));
|
wxCHECK_RET(DeleteStatusbar(), _T("Failed to delete status bar."));
|
||||||
|
@ -1057,7 +1059,6 @@ void CAdvancedFrame::OnActivitySelection(wxCommandEvent& event) {
|
||||||
wxASSERT(pDoc);
|
wxASSERT(pDoc);
|
||||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||||
|
|
||||||
|
|
||||||
switch(event.GetId()) {
|
switch(event.GetId()) {
|
||||||
case ID_FILEACTIVITYRUNALWAYS:
|
case ID_FILEACTIVITYRUNALWAYS:
|
||||||
pDoc->SetActivityRunMode(RUN_MODE_ALWAYS, 0);
|
pDoc->SetActivityRunMode(RUN_MODE_ALWAYS, 0);
|
||||||
|
@ -1493,6 +1494,7 @@ void CAdvancedFrame::OnOptionsOptions(wxCommandEvent& WXUNUSED(event)) {
|
||||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||||
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
|
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
|
||||||
|
|
||||||
|
pDoc->TestAsyncRPC(); return; // TEMPORARY FOR TESTING ASYNC RPCs -- CAF
|
||||||
|
|
||||||
// General Tab
|
// General Tab
|
||||||
dlg.m_LanguageSelectionCtrl->Append(wxGetApp().GetSupportedLanguages());
|
dlg.m_LanguageSelectionCtrl->Append(wxGetApp().GetSupportedLanguages());
|
||||||
|
@ -1843,6 +1845,22 @@ void CAdvancedFrame::OnUpdateStatus(CFrameEvent& event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CAdvancedFrame::OnUpdateMessages(CFrameEvent& event) {
|
||||||
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnUpdateMessages - Function Begin"));
|
||||||
|
|
||||||
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||||
|
|
||||||
|
wxASSERT(pDoc);
|
||||||
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||||
|
|
||||||
|
pDoc->CachedMessageUpdate();
|
||||||
|
FireRefreshView();
|
||||||
|
|
||||||
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnUpdateMessages - Function End"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CAdvancedFrame::OnRefreshState(wxTimerEvent &event) {
|
void CAdvancedFrame::OnRefreshState(wxTimerEvent &event) {
|
||||||
static bool bAlreadyRunningLoop = false;
|
static bool bAlreadyRunningLoop = false;
|
||||||
|
|
||||||
|
@ -1969,6 +1987,8 @@ void CAdvancedFrame::OnNotebookSelectionChanged(wxNotebookEvent& event) {
|
||||||
|
|
||||||
if ((-1 != event.GetSelection())) {
|
if ((-1 != event.GetSelection())) {
|
||||||
UpdateRefreshTimerInterval(event.GetSelection());
|
UpdateRefreshTimerInterval(event.GetSelection());
|
||||||
|
wxTimerEvent event (wxEVT_TIMER, ID_PERIODICRPCTIMER);
|
||||||
|
AddPendingEvent(event);
|
||||||
FireRefreshView();
|
FireRefreshView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2048,7 +2068,6 @@ void CAdvancedFrame::UpdateRefreshTimerInterval( wxInt32 iCurrentNotebookPage )
|
||||||
if (IsShown()) {
|
if (IsShown()) {
|
||||||
wxWindow* pwndNotebookPage = NULL;
|
wxWindow* pwndNotebookPage = NULL;
|
||||||
CBOINCBaseView* pView = NULL;
|
CBOINCBaseView* pView = NULL;
|
||||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
||||||
|
|
||||||
|
|
||||||
wxASSERT(m_pNotebook);
|
wxASSERT(m_pNotebook);
|
||||||
|
@ -2059,6 +2078,10 @@ void CAdvancedFrame::UpdateRefreshTimerInterval( wxInt32 iCurrentNotebookPage )
|
||||||
pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView);
|
pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView);
|
||||||
wxASSERT(pView);
|
wxASSERT(pView);
|
||||||
|
|
||||||
|
// TODO: Confirm we don't need to do something like the following for m_pPeriodicRPCTimer.
|
||||||
|
#if 0
|
||||||
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||||
|
|
||||||
if (m_pFrameListPanelRenderTimer && m_pFrameListPanelRenderTimer->IsRunning()) {
|
if (m_pFrameListPanelRenderTimer && m_pFrameListPanelRenderTimer->IsRunning()) {
|
||||||
m_pFrameListPanelRenderTimer->Stop();
|
m_pFrameListPanelRenderTimer->Stop();
|
||||||
|
|
||||||
|
@ -2076,6 +2099,7 @@ void CAdvancedFrame::UpdateRefreshTimerInterval( wxInt32 iCurrentNotebookPage )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::UpdateRefreshTimerInterval - Function End"));
|
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::UpdateRefreshTimerInterval - Function End"));
|
||||||
|
@ -2085,22 +2109,22 @@ void CAdvancedFrame::UpdateRefreshTimerInterval( wxInt32 iCurrentNotebookPage )
|
||||||
void CAdvancedFrame::StartTimers() {
|
void CAdvancedFrame::StartTimers() {
|
||||||
wxASSERT(m_pRefreshStateTimer);
|
wxASSERT(m_pRefreshStateTimer);
|
||||||
wxASSERT(m_pFrameRenderTimer);
|
wxASSERT(m_pFrameRenderTimer);
|
||||||
wxASSERT(m_pFrameListPanelRenderTimer);
|
// wxASSERT(m_pFrameListPanelRenderTimer);
|
||||||
CBOINCBaseFrame::StartTimers();
|
CBOINCBaseFrame::StartTimers();
|
||||||
m_pRefreshStateTimer->Start();
|
m_pRefreshStateTimer->Start();
|
||||||
m_pFrameRenderTimer->Start();
|
m_pFrameRenderTimer->Start();
|
||||||
m_pFrameListPanelRenderTimer->Start();
|
// m_pFrameListPanelRenderTimer->Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CAdvancedFrame::StopTimers() {
|
void CAdvancedFrame::StopTimers() {
|
||||||
wxASSERT(m_pRefreshStateTimer);
|
wxASSERT(m_pRefreshStateTimer);
|
||||||
wxASSERT(m_pFrameRenderTimer);
|
wxASSERT(m_pFrameRenderTimer);
|
||||||
wxASSERT(m_pFrameListPanelRenderTimer);
|
// wxASSERT(m_pFrameListPanelRenderTimer);
|
||||||
CBOINCBaseFrame::StopTimers();
|
CBOINCBaseFrame::StopTimers();
|
||||||
m_pRefreshStateTimer->Stop();
|
m_pRefreshStateTimer->Stop();
|
||||||
m_pFrameRenderTimer->Stop();
|
m_pFrameRenderTimer->Stop();
|
||||||
m_pFrameListPanelRenderTimer->Stop();
|
// m_pFrameListPanelRenderTimer->Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -91,12 +91,13 @@ public:
|
||||||
void OnRefreshView( CFrameEvent& event );
|
void OnRefreshView( CFrameEvent& event );
|
||||||
void OnConnect( CFrameEvent& event );
|
void OnConnect( CFrameEvent& event );
|
||||||
void OnUpdateStatus( CFrameEvent& event );
|
void OnUpdateStatus( CFrameEvent& event );
|
||||||
|
void OnUpdateMessages( CFrameEvent& event );
|
||||||
|
|
||||||
void ResetReminderTimers();
|
void ResetReminderTimers();
|
||||||
|
|
||||||
wxTimer* m_pRefreshStateTimer;
|
wxTimer* m_pRefreshStateTimer;
|
||||||
wxTimer* m_pFrameRenderTimer;
|
wxTimer* m_pFrameRenderTimer;
|
||||||
wxTimer* m_pFrameListPanelRenderTimer;
|
// wxTimer* m_pFrameListPanelRenderTimer;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -404,7 +404,7 @@ int CMainDocument::RequestRPC(ASYNC_RPC_REQUEST& request, bool hasPriority) {
|
||||||
if (iter->isSameAs(request)) return 0;
|
if (iter->isSameAs(request)) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((request.event == NULL) && (request.resultPtr == NULL)) {
|
if ((request.event == 0) && (request.resultPtr == NULL)) {
|
||||||
request.resultPtr = &retval;
|
request.resultPtr = &retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,7 +433,7 @@ int CMainDocument::RequestRPC(ASYNC_RPC_REQUEST& request, bool hasPriority) {
|
||||||
|
|
||||||
// If no completion event specified, this is a user-initiated event so
|
// If no completion event specified, this is a user-initiated event so
|
||||||
// wait for completion but show a dialog allowing the user to cancel.
|
// wait for completion but show a dialog allowing the user to cancel.
|
||||||
if (request.event == NULL) {
|
if (request.event == 0) {
|
||||||
// TODO: proper handling if a second user request is received while first is pending
|
// TODO: proper handling if a second user request is received while first is pending
|
||||||
// if (inUserRequest) {
|
// if (inUserRequest) {
|
||||||
if (m_bWaitingForRPC) {
|
if (m_bWaitingForRPC) {
|
||||||
|
@ -567,7 +567,7 @@ void CMainDocument::OnRPCComplete(CRPCFinishedEvent& event) {
|
||||||
RPC_requests[i].event = NULL; // Is this needed to prevent calling the event's destructor?
|
RPC_requests[i].event = NULL; // Is this needed to prevent calling the event's destructor?
|
||||||
RPC_requests.erase(RPC_requests.begin()+i);
|
RPC_requests.erase(RPC_requests.begin()+i);
|
||||||
} else {
|
} else {
|
||||||
if (RPC_requests[i].event == NULL) {
|
if (RPC_requests[i].event == 0) {
|
||||||
stillWaitingForPendingRequests = true;
|
stillWaitingForPendingRequests = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -601,15 +601,13 @@ void CMainDocument::OnRPCComplete(CRPCFinishedEvent& event) {
|
||||||
*(completed_RPC_requests[i].resultPtr) = retval;
|
*(completed_RPC_requests[i].resultPtr) = retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1 // Post-processing
|
// Post-processing
|
||||||
switch (completed_RPC_requests[i].which_rpc) {
|
switch (completed_RPC_requests[i].which_rpc) {
|
||||||
case RPC_AUTHORIZE:
|
case RPC_AUTHORIZE:
|
||||||
break;
|
break;
|
||||||
case RPC_EXCHANGE_VERSIONS:
|
case RPC_EXCHANGE_VERSIONS:
|
||||||
break;
|
break;
|
||||||
case RPC_GET_STATE:
|
case RPC_GET_STATE:
|
||||||
// m_iGet_state_RPC_retval = retval;
|
|
||||||
// TODO: Implement buffer swapping, buffer time stamp
|
|
||||||
if (completed_RPC_requests[i].exchangeBuf) {
|
if (completed_RPC_requests[i].exchangeBuf) {
|
||||||
CC_STATE* arg1 = (CC_STATE*)completed_RPC_requests[i].arg1;
|
CC_STATE* arg1 = (CC_STATE*)completed_RPC_requests[i].arg1;
|
||||||
CC_STATE* exchangeBuf = (CC_STATE*)completed_RPC_requests[i].exchangeBuf;
|
CC_STATE* exchangeBuf = (CC_STATE*)completed_RPC_requests[i].exchangeBuf;
|
||||||
|
@ -625,8 +623,6 @@ void CMainDocument::OnRPCComplete(CRPCFinishedEvent& event) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RPC_GET_RESULTS:
|
case RPC_GET_RESULTS:
|
||||||
// m_iGet_results_RPC_retval = retval;
|
|
||||||
// TODO: Implement buffer swapping, buffer time stamp
|
|
||||||
if (completed_RPC_requests[i].exchangeBuf) {
|
if (completed_RPC_requests[i].exchangeBuf) {
|
||||||
RESULTS* arg1 = (RESULTS*)completed_RPC_requests[i].arg1;
|
RESULTS* arg1 = (RESULTS*)completed_RPC_requests[i].arg1;
|
||||||
RESULTS* exchangeBuf = (RESULTS*)completed_RPC_requests[i].exchangeBuf;
|
RESULTS* exchangeBuf = (RESULTS*)completed_RPC_requests[i].exchangeBuf;
|
||||||
|
@ -634,18 +630,26 @@ void CMainDocument::OnRPCComplete(CRPCFinishedEvent& event) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RPC_GET_FILE_TRANSFERS:
|
case RPC_GET_FILE_TRANSFERS:
|
||||||
|
if (completed_RPC_requests[i].exchangeBuf) {
|
||||||
|
FILE_TRANSFERS* arg1 = (FILE_TRANSFERS*)completed_RPC_requests[i].arg1;
|
||||||
|
FILE_TRANSFERS* exchangeBuf = (FILE_TRANSFERS*)completed_RPC_requests[i].exchangeBuf;
|
||||||
|
arg1->file_transfers.swap(exchangeBuf->file_transfers);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case RPC_GET_SIMPLE_GUI_INFO1:
|
case RPC_GET_SIMPLE_GUI_INFO1:
|
||||||
break;
|
break;
|
||||||
case RPC_GET_SIMPLE_GUI_INFO2:
|
case RPC_GET_SIMPLE_GUI_INFO2:
|
||||||
break;
|
break;
|
||||||
case RPC_GET_PROJECT_STATUS1:
|
case RPC_GET_PROJECT_STATUS1:
|
||||||
|
if (completed_RPC_requests[i].exchangeBuf) {
|
||||||
|
CC_STATE* arg1 = (CC_STATE*)completed_RPC_requests[i].arg1;
|
||||||
|
CC_STATE* exchangeBuf = (CC_STATE*)completed_RPC_requests[i].exchangeBuf;
|
||||||
|
arg1->projects.swap(exchangeBuf->projects);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case RPC_GET_PROJECT_STATUS2:
|
case RPC_GET_PROJECT_STATUS2:
|
||||||
break;
|
break;
|
||||||
case RPC_GET_ALL_PROJECTS_LIST:
|
case RPC_GET_ALL_PROJECTS_LIST:
|
||||||
// m_iGet_all_projects_list_RPC_retval = retval;
|
|
||||||
// TODO: Implement buffer swapping, buffer time stamp
|
|
||||||
if (completed_RPC_requests[i].exchangeBuf) {
|
if (completed_RPC_requests[i].exchangeBuf) {
|
||||||
ALL_PROJECTS_LIST* arg1 = (ALL_PROJECTS_LIST*)completed_RPC_requests[i].arg1;
|
ALL_PROJECTS_LIST* arg1 = (ALL_PROJECTS_LIST*)completed_RPC_requests[i].arg1;
|
||||||
ALL_PROJECTS_LIST* exchangeBuf = (ALL_PROJECTS_LIST*)completed_RPC_requests[i].exchangeBuf;
|
ALL_PROJECTS_LIST* exchangeBuf = (ALL_PROJECTS_LIST*)completed_RPC_requests[i].exchangeBuf;
|
||||||
|
@ -653,6 +657,13 @@ void CMainDocument::OnRPCComplete(CRPCFinishedEvent& event) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RPC_GET_DISK_USAGE:
|
case RPC_GET_DISK_USAGE:
|
||||||
|
DISK_USAGE* arg1 = (DISK_USAGE*)completed_RPC_requests[i].arg1;
|
||||||
|
DISK_USAGE* exchangeBuf = (DISK_USAGE*)completed_RPC_requests[i].exchangeBuf;
|
||||||
|
arg1->projects.swap(exchangeBuf->projects);
|
||||||
|
exchangeBuf->d_total = arg1->d_total;
|
||||||
|
exchangeBuf->d_free = arg1->d_free;
|
||||||
|
exchangeBuf->d_boinc = arg1->d_boinc;
|
||||||
|
exchangeBuf->d_allowed = arg1->d_allowed;
|
||||||
break;
|
break;
|
||||||
case RPC_SHOW_GRAPHICS:
|
case RPC_SHOW_GRAPHICS:
|
||||||
break;
|
break;
|
||||||
|
@ -671,6 +682,11 @@ void CMainDocument::OnRPCComplete(CRPCFinishedEvent& event) {
|
||||||
case RPC_GET_PROXY_SETTINGS:
|
case RPC_GET_PROXY_SETTINGS:
|
||||||
break;
|
break;
|
||||||
case RPC_GET_MESSAGES:
|
case RPC_GET_MESSAGES:
|
||||||
|
if (completed_RPC_requests[i].exchangeBuf) {
|
||||||
|
MESSAGES* arg2 = (MESSAGES*)completed_RPC_requests[i].arg2;
|
||||||
|
MESSAGES* exchangeBuf = (MESSAGES*)completed_RPC_requests[i].exchangeBuf;
|
||||||
|
arg2->messages.swap(exchangeBuf->messages);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case RPC_FILE_TRANSFER_OP:
|
case RPC_FILE_TRANSFER_OP:
|
||||||
break;
|
break;
|
||||||
|
@ -688,6 +704,11 @@ void CMainDocument::OnRPCComplete(CRPCFinishedEvent& event) {
|
||||||
case RPC_ACCT_MGR_INFO:
|
case RPC_ACCT_MGR_INFO:
|
||||||
break;
|
break;
|
||||||
case RPC_GET_STATISTICS:
|
case RPC_GET_STATISTICS:
|
||||||
|
if (completed_RPC_requests[i].exchangeBuf) {
|
||||||
|
PROJECTS* arg1 = (PROJECTS*)completed_RPC_requests[i].arg1;
|
||||||
|
PROJECTS* exchangeBuf = (PROJECTS*)completed_RPC_requests[i].exchangeBuf;
|
||||||
|
arg1->projects.swap(exchangeBuf->projects);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case RPC_NETWORK_AVAILABLE:
|
case RPC_NETWORK_AVAILABLE:
|
||||||
break;
|
break;
|
||||||
|
@ -747,11 +768,11 @@ void CMainDocument::OnRPCComplete(CRPCFinishedEvent& event) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // Post-processing
|
|
||||||
|
|
||||||
if ( (completed_RPC_requests[i].event) && (completed_RPC_requests[i].event != (wxEvent*)-1) ) {
|
if ( (completed_RPC_requests[i].event) && (completed_RPC_requests[i].event != (wxEvent*)-1) ) {
|
||||||
if (completed_RPC_requests[i].eventHandler) {
|
if (completed_RPC_requests[i].eventHandler) {
|
||||||
completed_RPC_requests[i].eventHandler->ProcessEvent(*completed_RPC_requests[i].event);
|
completed_RPC_requests[i].eventHandler->ProcessEvent(*completed_RPC_requests[i].event);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// We must get the frame immediately before using it,
|
// We must get the frame immediately before using it,
|
||||||
// since it may have been changed by SetActiveGUI().
|
// since it may have been changed by SetActiveGUI().
|
||||||
|
@ -845,7 +866,7 @@ void CMainDocument::TestAsyncRPC() { // TEMPORARY FOR TESTING ASYNC RPCs
|
||||||
ALL_PROJECTS_LIST pl;
|
ALL_PROJECTS_LIST pl;
|
||||||
ASYNC_RPC_REQUEST request;
|
ASYNC_RPC_REQUEST request;
|
||||||
wxDateTime completionTime = wxDateTime((time_t)0);
|
wxDateTime completionTime = wxDateTime((time_t)0);
|
||||||
int retval = 0;
|
int req_retval = 0, rpc_result = 0;
|
||||||
|
|
||||||
completionTime.ResetTime();
|
completionTime.ResetTime();
|
||||||
|
|
||||||
|
@ -859,17 +880,17 @@ void CMainDocument::TestAsyncRPC() { // TEMPORARY FOR TESTING ASYNC RPCs
|
||||||
request.eventHandler = NULL;
|
request.eventHandler = NULL;
|
||||||
request.completionTime = &completionTime;
|
request.completionTime = &completionTime;
|
||||||
// request.result = NULL;
|
// request.result = NULL;
|
||||||
request.resultPtr = &m_iGet_state_RPC_retval; // TEMPORARY FOR TESTING ASYNC RPCs -- CAF
|
request.resultPtr = &rpc_result; // TEMPORARY FOR TESTING ASYNC RPCs -- CAF
|
||||||
request.isActive = false;
|
request.isActive = false;
|
||||||
|
|
||||||
//retval = rpcClient.get_all_projects_list(pl);
|
//retval = rpcClient.get_all_projects_list(pl);
|
||||||
|
|
||||||
retval = RequestRPC(request, true);
|
req_retval = RequestRPC(request, true);
|
||||||
|
|
||||||
wxString s = completionTime.FormatTime();
|
wxString s = completionTime.FormatTime();
|
||||||
wxLogMessage(wxT("Completion time = %s"), s.c_str());
|
wxLogMessage(wxT("Completion time = %s"), s.c_str());
|
||||||
wxLogMessage(wxT("RequestRPC returned %d\n"), retval);
|
wxLogMessage(wxT("RequestRPC returned %d\n"), req_retval);
|
||||||
::wxSafeYield(NULL, true); // Allow processing of RPC_FINISHED event
|
::wxSafeYield(NULL, true); // Allow processing of RPC_FINISHED event
|
||||||
wxLogMessage(wxT("rpcClient.get_all_projects_list returned %d\n"), m_iGet_state_RPC_retval);
|
wxLogMessage(wxT("rpcClient.get_all_projects_list returned %d\n"), rpc_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ DEFINE_EVENT_TYPE(wxEVT_FRAME_INITIALIZED)
|
||||||
DEFINE_EVENT_TYPE(wxEVT_FRAME_REFRESHVIEW)
|
DEFINE_EVENT_TYPE(wxEVT_FRAME_REFRESHVIEW)
|
||||||
DEFINE_EVENT_TYPE(wxEVT_FRAME_UPDATESTATUS)
|
DEFINE_EVENT_TYPE(wxEVT_FRAME_UPDATESTATUS)
|
||||||
DEFINE_EVENT_TYPE(wxEVT_FRAME_RELOADSKIN)
|
DEFINE_EVENT_TYPE(wxEVT_FRAME_RELOADSKIN)
|
||||||
|
DEFINE_EVENT_TYPE(wxEVT_FRAME_UPDATEMESSAGES)
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(CBOINCBaseFrame, wxFrame)
|
IMPLEMENT_DYNAMIC_CLASS(CBOINCBaseFrame, wxFrame)
|
||||||
|
|
|
@ -184,6 +184,8 @@ DECLARE_EVENT_TYPE( wxEVT_FRAME_INITIALIZED, 10004 )
|
||||||
DECLARE_EVENT_TYPE( wxEVT_FRAME_REFRESHVIEW, 10005 )
|
DECLARE_EVENT_TYPE( wxEVT_FRAME_REFRESHVIEW, 10005 )
|
||||||
DECLARE_EVENT_TYPE( wxEVT_FRAME_UPDATESTATUS, 10006 )
|
DECLARE_EVENT_TYPE( wxEVT_FRAME_UPDATESTATUS, 10006 )
|
||||||
DECLARE_EVENT_TYPE( wxEVT_FRAME_RELOADSKIN, 10007 )
|
DECLARE_EVENT_TYPE( wxEVT_FRAME_RELOADSKIN, 10007 )
|
||||||
|
DECLARE_EVENT_TYPE( wxEVT_FRAME_UPDATEMESSAGES, 10008 )
|
||||||
|
|
||||||
END_DECLARE_EVENT_TYPES()
|
END_DECLARE_EVENT_TYPES()
|
||||||
|
|
||||||
#define EVT_FRAME_ALERT(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_FRAME_ALERT, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
#define EVT_FRAME_ALERT(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_FRAME_ALERT, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
||||||
|
@ -192,6 +194,7 @@ END_DECLARE_EVENT_TYPES()
|
||||||
#define EVT_FRAME_REFRESH(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_FRAME_REFRESHVIEW, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
#define EVT_FRAME_REFRESH(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_FRAME_REFRESHVIEW, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
||||||
#define EVT_FRAME_UPDATESTATUS(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_FRAME_UPDATESTATUS, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
#define EVT_FRAME_UPDATESTATUS(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_FRAME_UPDATESTATUS, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
||||||
#define EVT_FRAME_RELOADSKIN(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_FRAME_RELOADSKIN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
#define EVT_FRAME_RELOADSKIN(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_FRAME_RELOADSKIN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
||||||
|
#define EVT_FRAME_UPDATEMESSAGES(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_FRAME_UPDATEMESSAGES, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -189,7 +189,10 @@ int CBOINCBaseView::GetListRowCount() {
|
||||||
|
|
||||||
|
|
||||||
void CBOINCBaseView::FireOnListRender(wxTimerEvent& event) {
|
void CBOINCBaseView::FireOnListRender(wxTimerEvent& event) {
|
||||||
|
extern bool LogRPCs;
|
||||||
|
LogRPCs = true; // TEMPORARY FOR TESTING ASYNC RPCs -- CAF
|
||||||
OnListRender(event);
|
OnListRender(event);
|
||||||
|
LogRPCs=false; // TEMPORARY FOR TESTING ASYNC RPCs -- CAF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -350,16 +350,25 @@ CMainDocument::CMainDocument() : rpc(this) {
|
||||||
m_iMessageSequenceNumber = 0;
|
m_iMessageSequenceNumber = 0;
|
||||||
|
|
||||||
m_dtCachedStateTimestamp = wxDateTime((time_t)0);
|
m_dtCachedStateTimestamp = wxDateTime((time_t)0);
|
||||||
cc_state_rpc_result = 0;
|
m_iGet_state_rpc_result = 0;
|
||||||
host_info_rpc_result = 0;
|
m_iGet_host_info_rpc_result = 0;
|
||||||
|
|
||||||
|
|
||||||
m_dtCachedCCStatusTimestamp = wxDateTime((time_t)0);
|
m_dtCachedCCStatusTimestamp = wxDateTime((time_t)0);
|
||||||
cc_status_rpc_result = 0;
|
m_iGet_status_rpc_result = 0;
|
||||||
|
|
||||||
m_dtProjecStatusTimestamp = wxDateTime((time_t)0);
|
m_dtProjecStatusTimestamp = wxDateTime((time_t)0);
|
||||||
|
m_iGet_project_status1_rpc_result = -1;
|
||||||
|
|
||||||
m_dtResultsTimestamp = wxDateTime((time_t)0);
|
m_dtResultsTimestamp = wxDateTime((time_t)0);
|
||||||
|
m_iGet_results_rpc_result = 0;
|
||||||
|
|
||||||
m_dtKillInactiveGfxTimestamp = wxDateTime((time_t)0);
|
m_dtKillInactiveGfxTimestamp = wxDateTime((time_t)0);
|
||||||
m_dtFileTransfersTimestamp = wxDateTime((time_t)0);
|
m_dtFileTransfersTimestamp = wxDateTime((time_t)0);
|
||||||
|
m_iGet_file_transfers_rpc_result = 0;
|
||||||
|
|
||||||
|
m_iGet_messages_rpc_result = 0;
|
||||||
|
|
||||||
m_dtDiskUsageTimestamp = wxDateTime((time_t)0);
|
m_dtDiskUsageTimestamp = wxDateTime((time_t)0);
|
||||||
m_dtStatisticsStatusTimestamp = wxDateTime((time_t)0);
|
m_dtStatisticsStatusTimestamp = wxDateTime((time_t)0);
|
||||||
m_dtCachedSimpleGUITimestamp = wxDateTime((time_t)0);
|
m_dtCachedSimpleGUITimestamp = wxDateTime((time_t)0);
|
||||||
|
@ -485,8 +494,8 @@ int CMainDocument::CachedStateUpdate() {
|
||||||
// Most of this is now handled by RunPeriodicRPCs() and ForceCacheUpdate()
|
// Most of this is now handled by RunPeriodicRPCs() and ForceCacheUpdate()
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
if (cc_state_rpc_result) retval = cc_state_rpc_result;
|
if (m_iGet_state_rpc_result) retval = m_iGet_state_rpc_result;
|
||||||
if (host_info_rpc_result) retval = host_info_rpc_result;
|
if (m_iGet_host_info_rpc_result) retval = m_iGet_host_info_rpc_result;
|
||||||
|
|
||||||
if (retval) m_pNetworkConnection->SetStateDisconnected();
|
if (retval) m_pNetworkConnection->SetStateDisconnected();
|
||||||
|
|
||||||
|
@ -589,13 +598,13 @@ int CMainDocument::GetCoreClientStatus(CC_STATUS& ccs, bool bForce) {
|
||||||
if (0 == iRetVal) {
|
if (0 == iRetVal) {
|
||||||
status = ccs;
|
status = ccs;
|
||||||
} else {
|
} else {
|
||||||
cc_status_rpc_result = iRetVal;
|
m_iGet_status_rpc_result = iRetVal;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ccs = status;
|
ccs = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cc_status_rpc_result) {
|
if (m_iGet_status_rpc_result) {
|
||||||
m_pNetworkConnection->SetStateDisconnected();
|
m_pNetworkConnection->SetStateDisconnected();
|
||||||
} else {
|
} else {
|
||||||
if (ccs.manager_must_quit) {
|
if (ccs.manager_must_quit) {
|
||||||
|
@ -653,28 +662,32 @@ int CMainDocument::SetNetworkRunMode(int iMode, int iTimeout) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: RunPeriodicRPCs()
|
||||||
void CMainDocument::RunPeriodicRPCs() {
|
void CMainDocument::RunPeriodicRPCs() {
|
||||||
ASYNC_RPC_REQUEST request;
|
ASYNC_RPC_REQUEST request;
|
||||||
wxDateTime dtNow(wxDateTime::Now());
|
|
||||||
// int retval = 0;
|
// int retval = 0;
|
||||||
|
|
||||||
|
if (!IsConnected()) return;
|
||||||
|
|
||||||
int currentTabView = wxGetApp().GetCurrentViewPage();
|
int currentTabView = wxGetApp().GetCurrentViewPage();
|
||||||
|
|
||||||
if (!IsConnected()) return;
|
CBOINCBaseFrame* pFrame = wxGetApp().GetFrame();
|
||||||
|
wxASSERT(wxDynamicCast(pFrame, CBOINCBaseFrame));
|
||||||
|
|
||||||
|
wxDateTime dtNow(wxDateTime::Now());
|
||||||
|
|
||||||
// *********** RPC_GET_CC_STATUS **************
|
// *********** RPC_GET_CC_STATUS **************
|
||||||
|
|
||||||
wxTimeSpan ts(dtNow - m_dtCachedCCStatusTimestamp);
|
wxTimeSpan ts(dtNow - m_dtCachedCCStatusTimestamp);
|
||||||
if (ts.GetSeconds() > 0) {
|
if (ts.GetSeconds() > 0) {
|
||||||
m_dtCachedCCStatusTimestamp = wxDateTime::Now();
|
// m_dtCachedCCStatusTimestamp = wxDateTime::Now();
|
||||||
|
|
||||||
request.clear();
|
request.clear();
|
||||||
request.which_rpc = RPC_GET_CC_STATUS;
|
request.which_rpc = RPC_GET_CC_STATUS;
|
||||||
request.arg1 = &status_altbuf;
|
request.arg1 = &async_status_buf;
|
||||||
request.exchangeBuf = &status;
|
request.exchangeBuf = &status;
|
||||||
request.event = (wxEvent*)-1;
|
request.event = (wxEvent*)-1;
|
||||||
request.completionTime = &m_dtCachedCCStatusTimestamp;
|
request.completionTime = &m_dtCachedCCStatusTimestamp;
|
||||||
request.resultPtr = &cc_status_rpc_result;
|
request.resultPtr = &m_iGet_status_rpc_result;
|
||||||
|
|
||||||
RequestRPC(request);
|
RequestRPC(request);
|
||||||
}
|
}
|
||||||
|
@ -686,10 +699,10 @@ void CMainDocument::RunPeriodicRPCs() {
|
||||||
|
|
||||||
request.clear();
|
request.clear();
|
||||||
request.which_rpc = RPC_GET_STATE;
|
request.which_rpc = RPC_GET_STATE;
|
||||||
request.arg1 = &state_altbuf;
|
request.arg1 = &async_state_buf;
|
||||||
request.exchangeBuf = &state;
|
request.exchangeBuf = &state;
|
||||||
request.event = (wxEvent*)-1;
|
request.event = (wxEvent*)-1;
|
||||||
request.resultPtr = &cc_state_rpc_result;
|
request.resultPtr = &m_iGet_state_rpc_result;
|
||||||
|
|
||||||
RequestRPC(request);
|
RequestRPC(request);
|
||||||
|
|
||||||
|
@ -697,14 +710,135 @@ void CMainDocument::RunPeriodicRPCs() {
|
||||||
|
|
||||||
request.clear();
|
request.clear();
|
||||||
request.which_rpc = RPC_GET_HOST_INFO;
|
request.which_rpc = RPC_GET_HOST_INFO;
|
||||||
request.arg1 = &host_altbuf;
|
request.arg1 = &async_host_buf;
|
||||||
request.exchangeBuf = &host;
|
request.exchangeBuf = &host;
|
||||||
request.event = (wxEvent*)-1;
|
request.event = (wxEvent*)-1;
|
||||||
request.completionTime = &m_dtCachedStateTimestamp;
|
request.completionTime = &m_dtCachedStateTimestamp;
|
||||||
request.resultPtr = &host_info_rpc_result;
|
request.resultPtr = &m_iGet_host_info_rpc_result;
|
||||||
|
|
||||||
RequestRPC(request);
|
RequestRPC(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *********** RPC_GET_PROJECT_STATUS1 **************
|
||||||
|
|
||||||
|
if (currentTabView & VW_PROJ) {
|
||||||
|
wxTimeSpan ts(dtNow - m_dtProjecStatusTimestamp);
|
||||||
|
if (ts.GetSeconds() > 0) {
|
||||||
|
request.clear();
|
||||||
|
request.which_rpc = RPC_GET_PROJECT_STATUS1;
|
||||||
|
request.arg1 = &async_state_buf.projects;
|
||||||
|
request.exchangeBuf = &state.projects;
|
||||||
|
request.event = new CFrameEvent(wxEVT_FRAME_REFRESHVIEW, pFrame);
|
||||||
|
// NULL request.eventHandler means use CBOINCBaseFrame when RPC has
|
||||||
|
// finished, which may have changed since request was made
|
||||||
|
request.completionTime = &m_dtProjecStatusTimestamp;
|
||||||
|
request.resultPtr = &m_iGet_project_status1_rpc_result;
|
||||||
|
|
||||||
|
RequestRPC(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// *********** RPC_GET_RESULTS **************
|
||||||
|
|
||||||
|
if (currentTabView & VW_TASK) {
|
||||||
|
wxTimeSpan ts(dtNow - m_dtResultsTimestamp);
|
||||||
|
if (ts.GetSeconds() > 0) {
|
||||||
|
request.clear();
|
||||||
|
request.which_rpc = RPC_GET_RESULTS;
|
||||||
|
request.arg1 = &async_results_buf;
|
||||||
|
request.exchangeBuf = &results;
|
||||||
|
request.event = new CFrameEvent(wxEVT_FRAME_REFRESHVIEW, pFrame);
|
||||||
|
// NULL request.eventHandler means use CBOINCBaseFrame when RPC has
|
||||||
|
// finished, which may have changed since request was made
|
||||||
|
request.completionTime = &m_dtResultsTimestamp;
|
||||||
|
request.resultPtr = &m_iGet_results_rpc_result;
|
||||||
|
|
||||||
|
RequestRPC(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// *********** RPC_GET_FILE_TRANSFERS **************
|
||||||
|
|
||||||
|
if (currentTabView & VW_XFER) {
|
||||||
|
wxTimeSpan ts(dtNow - m_dtFileTransfersTimestamp);
|
||||||
|
if (ts.GetSeconds() > 0) {
|
||||||
|
request.clear();
|
||||||
|
request.which_rpc = RPC_GET_FILE_TRANSFERS;
|
||||||
|
request.arg1 = &async_ft_buf;
|
||||||
|
request.exchangeBuf = &ft;
|
||||||
|
request.event = new CFrameEvent(wxEVT_FRAME_REFRESHVIEW, pFrame);
|
||||||
|
// NULL request.eventHandler means use CBOINCBaseFrame when RPC has
|
||||||
|
// finished, which may have changed since request was made
|
||||||
|
request.completionTime = &m_dtFileTransfersTimestamp;
|
||||||
|
request.resultPtr = &m_iGet_file_transfers_rpc_result;
|
||||||
|
|
||||||
|
RequestRPC(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// *********** RPC_GET_MESSAGES **************
|
||||||
|
|
||||||
|
if (currentTabView & VW_MSGS) {
|
||||||
|
request.clear();
|
||||||
|
request.which_rpc = RPC_GET_MESSAGES;
|
||||||
|
// m_iMessageSequenceNumber could change between request and execution
|
||||||
|
// of RPC, so pass in a pointer rather than its value
|
||||||
|
request.arg1 = &m_iMessageSequenceNumber;
|
||||||
|
request.arg2 = &messages;
|
||||||
|
// request.arg2 = &async_messages_buf;
|
||||||
|
// request.exchangeBuf = &messages;
|
||||||
|
request.event = new CFrameEvent(wxEVT_FRAME_UPDATEMESSAGES, pFrame);
|
||||||
|
// NULL request.eventHandler means use CBOINCBaseFrame when RPC has
|
||||||
|
// finished, which may have changed since request was made
|
||||||
|
request.completionTime = NULL;
|
||||||
|
request.resultPtr = &m_iGet_messages_rpc_result;
|
||||||
|
|
||||||
|
RequestRPC(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
// *********** RPC_GET_STATISTICS **************
|
||||||
|
|
||||||
|
if (currentTabView & VW_STAT) {
|
||||||
|
wxTimeSpan ts(dtNow - m_dtStatisticsStatusTimestamp);
|
||||||
|
if (ts.GetSeconds() > 60) {
|
||||||
|
request.clear();
|
||||||
|
request.which_rpc = RPC_GET_STATISTICS;
|
||||||
|
request.arg1 = &async_statistics_status_buf;
|
||||||
|
request.exchangeBuf = &statistics_status;
|
||||||
|
request.event = new CFrameEvent(wxEVT_FRAME_REFRESHVIEW, pFrame);
|
||||||
|
// NULL request.eventHandler means use CBOINCBaseFrame when RPC has
|
||||||
|
// finished, which may have changed since request was made
|
||||||
|
request.completionTime = &m_dtStatisticsStatusTimestamp;
|
||||||
|
request.resultPtr = &m_iGet_statistics_rpc_result;
|
||||||
|
|
||||||
|
RequestRPC(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// *********** RPC_GET_DISK_USAGE **************
|
||||||
|
|
||||||
|
if (currentTabView & VW_DISK) {
|
||||||
|
wxTimeSpan ts(dtNow - m_dtDiskUsageTimestamp);
|
||||||
|
if ((ts.GetSeconds() > 60) || disk_usage.projects.empty()) {
|
||||||
|
request.clear();
|
||||||
|
request.which_rpc = RPC_GET_DISK_USAGE;
|
||||||
|
request.arg1 = &async_disk_usage_buf;
|
||||||
|
request.exchangeBuf = &disk_usage;
|
||||||
|
request.event = new CFrameEvent(wxEVT_FRAME_REFRESHVIEW, pFrame);
|
||||||
|
// NULL request.eventHandler means use CBOINCBaseFrame when RPC has
|
||||||
|
// finished, which may have changed since request was made
|
||||||
|
request.completionTime = &m_dtDiskUsageTimestamp;
|
||||||
|
request.resultPtr = &m_iGet_dsk_usage_rpc_result;
|
||||||
|
|
||||||
|
RequestRPC(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// *********** GET_SIMPLE_GUI_INFO1, GET_SIMPLE_GUI_INFO2, etc. **************
|
||||||
|
|
||||||
|
if (currentTabView & VW_SGUI) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -731,7 +865,7 @@ int CMainDocument::ForceCacheUpdate() {
|
||||||
m_dtCachedStateTimestamp = wxDateTime::Now();
|
m_dtCachedStateTimestamp = wxDateTime::Now();
|
||||||
retval = rpc.get_state(state);
|
retval = rpc.get_state(state);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
cc_state_rpc_result = retval;
|
m_iGet_state_rpc_result = retval;
|
||||||
wxLogTrace(wxT("Function Status"), wxT("CMainDocument::ForceCacheUpdate - Get State Failed '%d'"), retval);
|
wxLogTrace(wxT("Function Status"), wxT("CMainDocument::ForceCacheUpdate - Get State Failed '%d'"), retval);
|
||||||
m_pNetworkConnection->SetStateDisconnected();
|
m_pNetworkConnection->SetStateDisconnected();
|
||||||
}
|
}
|
||||||
|
@ -739,7 +873,7 @@ int CMainDocument::ForceCacheUpdate() {
|
||||||
|
|
||||||
retval = rpc.get_host_info(host);
|
retval = rpc.get_host_info(host);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
host_info_rpc_result = retval;
|
m_iGet_host_info_rpc_result = retval;
|
||||||
wxLogTrace(wxT("Function Status"), wxT("CMainDocument::ForceCacheUpdate - Get Host Information Failed '%d'"), retval);
|
wxLogTrace(wxT("Function Status"), wxT("CMainDocument::ForceCacheUpdate - Get Host Information Failed '%d'"), retval);
|
||||||
m_pNetworkConnection->SetStateDisconnected();
|
m_pNetworkConnection->SetStateDisconnected();
|
||||||
}
|
}
|
||||||
|
@ -817,30 +951,22 @@ bool CMainDocument::IsUserAuthorized() {
|
||||||
|
|
||||||
|
|
||||||
int CMainDocument::CachedProjectStatusUpdate() {
|
int CMainDocument::CachedProjectStatusUpdate() {
|
||||||
int iRetVal = 0;
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (IsConnected()) {
|
if (! IsConnected()) return -1;
|
||||||
wxTimeSpan ts(wxDateTime::Now() - m_dtProjecStatusTimestamp);
|
|
||||||
if (ts.GetSeconds() > 0) {
|
|
||||||
m_dtProjecStatusTimestamp = wxDateTime::Now();
|
|
||||||
|
|
||||||
iRetVal = rpc.get_project_status(state);
|
if (m_iGet_project_status1_rpc_result) {
|
||||||
if (iRetVal) {
|
wxLogTrace(wxT("Function Status"), wxT("CMainDocument::CachedProjectStatusUpdate - Get Project Status Failed '%d'"), m_iGet_project_status1_rpc_result);
|
||||||
wxLogTrace(wxT("Function Status"), wxT("CMainDocument::CachedProjectStatusUpdate - Get Project Status Failed '%d'"), iRetVal);
|
ForceCacheUpdate();
|
||||||
ForceCacheUpdate();
|
// return m_iGet_project_status1_rpc_result;
|
||||||
}
|
|
||||||
|
|
||||||
m_fProjectTotalResourceShare = 0.0;
|
|
||||||
for (i=0; i < (long)state.projects.size(); i++) {
|
|
||||||
m_fProjectTotalResourceShare += state.projects.at(i)->resource_share;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
iRetVal = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return iRetVal;
|
m_fProjectTotalResourceShare = 0.0;
|
||||||
|
for (i=0; i < (long)state.projects.size(); i++) {
|
||||||
|
m_fProjectTotalResourceShare += state.projects.at(i)->resource_share;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_iGet_project_status1_rpc_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1056,24 +1182,14 @@ int CMainDocument::ProjectAllowMoreWork(const wxString& projectname) {
|
||||||
|
|
||||||
|
|
||||||
int CMainDocument::CachedResultsStatusUpdate() {
|
int CMainDocument::CachedResultsStatusUpdate() {
|
||||||
int iRetVal = 0;
|
if (! IsConnected()) return -1;
|
||||||
|
|
||||||
if (IsConnected()) {
|
if (m_iGet_results_rpc_result) {
|
||||||
wxTimeSpan ts(wxDateTime::Now() - m_dtResultsTimestamp);
|
wxLogTrace(wxT("Function Status"), wxT("CMainDocument::CachedResultsStatusUpdate - Get Result Status Failed '%d'"), m_iGet_results_rpc_result);
|
||||||
if (ts.GetSeconds() > 0) {
|
ForceCacheUpdate();
|
||||||
m_dtResultsTimestamp = wxDateTime::Now();
|
|
||||||
|
|
||||||
iRetVal = rpc.get_results(results);
|
|
||||||
if (iRetVal) {
|
|
||||||
wxLogTrace(wxT("Function Status"), wxT("CMainDocument::CachedResultsStatusUpdate - Get Result Status Failed '%d'"), iRetVal);
|
|
||||||
ForceCacheUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
iRetVal = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return iRetVal;
|
return m_iGet_results_rpc_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1424,7 +1540,6 @@ int CMainDocument::WorkAbort(std::string& strProjectURL, std::string& strName) {
|
||||||
|
|
||||||
|
|
||||||
int CMainDocument::CachedMessageUpdate() {
|
int CMainDocument::CachedMessageUpdate() {
|
||||||
int retval;
|
|
||||||
static bool in_this_func = false;
|
static bool in_this_func = false;
|
||||||
static bool was_connected = false;
|
static bool was_connected = false;
|
||||||
|
|
||||||
|
@ -1436,9 +1551,10 @@ int CMainDocument::CachedMessageUpdate() {
|
||||||
ResetMessageState();
|
ResetMessageState();
|
||||||
was_connected = true;
|
was_connected = true;
|
||||||
}
|
}
|
||||||
retval = rpc.get_messages(m_iMessageSequenceNumber, messages);
|
// rpc.get_messages is now called from
|
||||||
if (retval) {
|
// retval = rpc.get_messages(m_iMessageSequenceNumber, messages);
|
||||||
wxLogTrace(wxT("Function Status"), wxT("CMainDocument::CachedMessageUpdate - Get Messages Failed '%d'"), retval);
|
if (m_iGet_messages_rpc_result) {
|
||||||
|
wxLogTrace(wxT("Function Status"), wxT("CMainDocument::CachedMessageUpdate - Get Messages Failed '%d'"), m_iGet_messages_rpc_result);
|
||||||
m_pNetworkConnection->SetStateDisconnected();
|
m_pNetworkConnection->SetStateDisconnected();
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -1473,12 +1589,13 @@ MESSAGE* CMainDocument::message(unsigned int i) {
|
||||||
int CMainDocument::GetMessageCount() {
|
int CMainDocument::GetMessageCount() {
|
||||||
int iCount = -1;
|
int iCount = -1;
|
||||||
|
|
||||||
CachedMessageUpdate();
|
// CachedMessageUpdate() is now called from CAdvancedFrame::OnUpdateMessages();
|
||||||
CachedStateUpdate();
|
CachedStateUpdate();
|
||||||
|
|
||||||
if (!messages.messages.empty())
|
if (!messages.messages.empty()) {
|
||||||
iCount = (int)messages.messages.size();
|
iCount = (int)messages.messages.size();
|
||||||
|
}
|
||||||
|
|
||||||
return iCount;
|
return iCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1486,29 +1603,20 @@ int CMainDocument::GetMessageCount() {
|
||||||
int CMainDocument::ResetMessageState() {
|
int CMainDocument::ResetMessageState() {
|
||||||
messages.clear();
|
messages.clear();
|
||||||
m_iMessageSequenceNumber = 0;
|
m_iMessageSequenceNumber = 0;
|
||||||
|
// m_iGet_messages_rpc_result = -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int CMainDocument::CachedFileTransfersUpdate() {
|
int CMainDocument::CachedFileTransfersUpdate() {
|
||||||
int iRetVal = 0;
|
if (! IsConnected()) return -1;
|
||||||
|
|
||||||
if (IsConnected()) {
|
if (m_iGet_file_transfers_rpc_result) {
|
||||||
wxTimeSpan ts(wxDateTime::Now() - m_dtFileTransfersTimestamp);
|
wxLogTrace(wxT("Function Status"), wxT("CMainDocument::CachedFileTransfersUpdate - Get File Transfers Failed '%d'"), m_iGet_file_transfers_rpc_result);
|
||||||
if (ts.GetSeconds() > 0) {
|
|
||||||
m_dtFileTransfersTimestamp = wxDateTime::Now();
|
|
||||||
|
|
||||||
iRetVal = rpc.get_file_transfers(ft);
|
|
||||||
if (iRetVal) {
|
|
||||||
wxLogTrace(wxT("Function Status"), wxT("CMainDocument::CachedFileTransfersUpdate - Get File Transfers Failed '%d'"), iRetVal);
|
|
||||||
ForceCacheUpdate();
|
ForceCacheUpdate();
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
iRetVal = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return iRetVal;
|
return m_iGet_file_transfers_rpc_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1616,28 +1724,14 @@ int CMainDocument::TransferAbort(const wxString& fileName, const wxString& proje
|
||||||
|
|
||||||
|
|
||||||
int CMainDocument::CachedDiskUsageUpdate() {
|
int CMainDocument::CachedDiskUsageUpdate() {
|
||||||
int iRetVal = 0;
|
if (! IsConnected()) return -1;
|
||||||
|
|
||||||
if (IsConnected()) {
|
if (m_iGet_dsk_usage_rpc_result) {
|
||||||
wxTimeSpan ts(wxDateTime::Now() - m_dtDiskUsageTimestamp);
|
wxLogTrace(wxT("Function Status"), wxT("Get Disk Usage Failed '%d'"), m_iGet_dsk_usage_rpc_result);
|
||||||
|
ForceCacheUpdate();
|
||||||
// don't get disk usage more than once per minute
|
|
||||||
// unless we just connected to a client
|
|
||||||
//
|
|
||||||
if ((ts.GetSeconds() > 60) || disk_usage.projects.empty()) {
|
|
||||||
m_dtDiskUsageTimestamp = wxDateTime::Now();
|
|
||||||
|
|
||||||
iRetVal = rpc.get_disk_usage(disk_usage);
|
|
||||||
if (iRetVal) {
|
|
||||||
wxLogTrace(wxT("Function Status"), wxT("Get Disk Usage Failed '%d'"), iRetVal);
|
|
||||||
ForceCacheUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
iRetVal = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return iRetVal;
|
return m_iGet_dsk_usage_rpc_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1657,24 +1751,14 @@ PROJECT* CMainDocument::DiskUsageProject(unsigned int i) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int CMainDocument::CachedStatisticsStatusUpdate() {
|
int CMainDocument::CachedStatisticsStatusUpdate() {
|
||||||
int iRetVal = 0;
|
if (! IsConnected()) return -1;
|
||||||
|
|
||||||
if (IsConnected()) {
|
if (m_iGet_statistics_rpc_result) {
|
||||||
wxTimeSpan ts(wxDateTime::Now() - m_dtStatisticsStatusTimestamp);
|
wxLogTrace(wxT("Function Status"), wxT("CMainDocument::CachedStatisticsStatusUpdate - Get Statistics Failed '%d'"), m_iGet_statistics_rpc_result);
|
||||||
if ((ts.GetSeconds() > 0) || statistics_status.projects.empty()) {
|
ForceCacheUpdate();
|
||||||
m_dtStatisticsStatusTimestamp = wxDateTime::Now();
|
|
||||||
|
|
||||||
iRetVal = rpc.get_statistics(statistics_status);
|
|
||||||
if (iRetVal) {
|
|
||||||
wxLogTrace(wxT("Function Status"), wxT("CMainDocument::CachedStatisticsStatusUpdate - Get Statistics Failed '%d'"), iRetVal);
|
|
||||||
ForceCacheUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
iRetVal = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return iRetVal;
|
return m_iGet_state_rpc_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -158,14 +158,16 @@ public:
|
||||||
AsyncRPC rpc;
|
AsyncRPC rpc;
|
||||||
RPC_CLIENT rpcClient;
|
RPC_CLIENT rpcClient;
|
||||||
CC_STATE state;
|
CC_STATE state;
|
||||||
CC_STATE state_altbuf;
|
CC_STATE async_state_buf;
|
||||||
int cc_state_rpc_result;
|
int m_iGet_state_rpc_result;
|
||||||
|
|
||||||
CC_STATUS status;
|
CC_STATUS status;
|
||||||
CC_STATUS status_altbuf;
|
CC_STATUS async_status_buf;
|
||||||
int cc_status_rpc_result;
|
int m_iGet_status_rpc_result;
|
||||||
|
|
||||||
HOST_INFO host;
|
HOST_INFO host;
|
||||||
HOST_INFO host_altbuf;
|
HOST_INFO async_host_buf;
|
||||||
int host_info_rpc_result;
|
int m_iGet_host_info_rpc_result;
|
||||||
wxDateTime m_dtCachedStateTimestamp;
|
wxDateTime m_dtCachedStateTimestamp;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -193,6 +195,7 @@ private:
|
||||||
//
|
//
|
||||||
private:
|
private:
|
||||||
int CachedProjectStatusUpdate();
|
int CachedProjectStatusUpdate();
|
||||||
|
int m_iGet_project_status1_rpc_result;
|
||||||
wxDateTime m_dtProjecStatusTimestamp;
|
wxDateTime m_dtProjecStatusTimestamp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -239,8 +242,8 @@ private:
|
||||||
public:
|
public:
|
||||||
RESULTS results;
|
RESULTS results;
|
||||||
RESULTS async_results_buf;
|
RESULTS async_results_buf;
|
||||||
int m_iGet_state_RPC_retval;
|
int m_iGet_results_rpc_result;
|
||||||
int m_iGet_results_RPC_retval;
|
|
||||||
RESULT* result(unsigned int);
|
RESULT* result(unsigned int);
|
||||||
RESULT* result(const wxString& name, const wxString& project_url);
|
RESULT* result(const wxString& name, const wxString& project_url);
|
||||||
|
|
||||||
|
@ -270,6 +273,9 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MESSAGES messages;
|
MESSAGES messages;
|
||||||
|
MESSAGES async_messages_buf;
|
||||||
|
int m_iGet_messages_rpc_result;
|
||||||
|
|
||||||
MESSAGE* message(unsigned int);
|
MESSAGE* message(unsigned int);
|
||||||
int CachedMessageUpdate();
|
int CachedMessageUpdate();
|
||||||
|
|
||||||
|
@ -289,6 +295,9 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FILE_TRANSFERS ft;
|
FILE_TRANSFERS ft;
|
||||||
|
FILE_TRANSFERS async_ft_buf;
|
||||||
|
int m_iGet_file_transfers_rpc_result;
|
||||||
|
|
||||||
FILE_TRANSFER* file_transfer(unsigned int);
|
FILE_TRANSFER* file_transfer(unsigned int);
|
||||||
FILE_TRANSFER* file_transfer(const wxString& fileName, const wxString& project_url);
|
FILE_TRANSFER* file_transfer(const wxString& fileName, const wxString& project_url);
|
||||||
|
|
||||||
|
@ -308,6 +317,9 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DISK_USAGE disk_usage;
|
DISK_USAGE disk_usage;
|
||||||
|
DISK_USAGE async_disk_usage_buf;
|
||||||
|
int m_iGet_dsk_usage_rpc_result;
|
||||||
|
|
||||||
PROJECT* DiskUsageProject(unsigned int);
|
PROJECT* DiskUsageProject(unsigned int);
|
||||||
int CachedDiskUsageUpdate();
|
int CachedDiskUsageUpdate();
|
||||||
|
|
||||||
|
@ -319,8 +331,10 @@ private:
|
||||||
wxDateTime m_dtStatisticsStatusTimestamp;
|
wxDateTime m_dtStatisticsStatusTimestamp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PROJECTS statistics_status;
|
PROJECTS statistics_status;
|
||||||
|
PROJECTS async_statistics_status_buf;
|
||||||
PROJECT* statistic(unsigned int);
|
PROJECT* statistic(unsigned int);
|
||||||
|
int m_iGet_statistics_rpc_result;
|
||||||
|
|
||||||
int GetStatisticsCount();
|
int GetStatisticsCount();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue