Commit d93eb6da authored by David Anderson's avatar David Anderson

- GUI RPC: finish the changed started above;

    update the way that app versions are identified.

Old: WORKUNIT contains version_num
    RESULT contains app_version_num (but only if running)

New: Keep old fields so new client works with old manager.
    RESULT contains version_num, plan_class
    Manager: if RESULT doesn't have version/plan_class
    (because talking to old client)
    look up app version based on WU version num.

svn path=/trunk/boinc/; revision=16903
parent 7660783a
......@@ -246,14 +246,37 @@ David 13 Jan 2009
lib/
gui_rpc_client_ops.cpp
gui_rpc_client.h
David 13 Jan 2009
- client: GPU bug fix; compile warning fixes
client/
client_types.cpp
clientgui/
BOINCTaskBar.cpp
lib/
filesys.cpp
David 13 Jan 2009
- client: GPU bug fix; compile warning fixes
client/
client_types.cpp
clientgui/
BOINCTaskBar.cpp
lib/
filesys.cpp
parse.cpp
David 13 Jan 2009
- GUI RPC: finish the changed started above;
update the way that app versions are identified.
Old: WORKUNIT contains version_num
RESULT contains app_version_num (but only if running)
New: Keep old fields so new client works with old manager.
RESULT contains version_num, plan_class
Manager: if RESULT doesn't have version/plan_class
(because talking to old client)
look up app version based on WU version num.
clientgui/
BOINCTaskBar.cpp
sg_ViewTabPage.cpp
MainDocument.cpp
DlgItemProperties.cpp
ViewWork.cpp
lib/
gui_rpc_client_ops.cpp
gui_rpc_client.h
......@@ -813,11 +813,13 @@ int CLIENT_STATE::write_state_gui(MIOFILE& f) {
}
}
f.printf(
"<platform_name>%s</platform_name>\n"
"<core_client_major_version>%d</core_client_major_version>\n"
"<core_client_minor_version>%d</core_client_minor_version>\n"
"<core_client_release>%d</core_client_release>\n"
"%s"
"%s",
get_primary_platform(),
core_client_version.major,
core_client_version.minor,
core_client_version.release,
......
......@@ -358,8 +358,7 @@ void CTaskBarIcon::OnMouseMove(wxTaskBarIconEvent& WXUNUSED(event)) {
if (iActiveTaskCount > 2) continue;
if (result) {
PROJECT* project = pDoc->state.lookup_project(result->project_url);
state_result = pDoc->state.lookup_result(project, result->name);
state_result = pDoc->state.lookup_result(result->project_url, result->name);
if (state_result) {
state_result->project->get_name(project_name);
strProjectName = wxString(project_name.c_str());
......
......@@ -197,18 +197,15 @@ wxString CDlgItemProperties::FormatApplicationName(RESULT* result ) {
CMainDocument* pDoc = wxGetApp().GetDocument();
RESULT* state_result = NULL;
wxString strLocalBuffer;
PROJECT* project;
wxASSERT(pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
if (result) {
project = pDoc->state.lookup_project(result->project_url);
state_result = pDoc->state.lookup_result(project, result->name);
state_result = pDoc->state.lookup_result(result->project_url, result->name);
if (!state_result) {
pDoc->ForceCacheUpdate();
project = pDoc->state.lookup_project(result->project_url);
state_result = pDoc->state.lookup_result(project, result->name);
state_result = pDoc->state.lookup_result(result->project_url, result->name);
}
wxASSERT(state_result);
......
......@@ -1435,8 +1435,7 @@ int CMainDocument::GetWorkCount() {
int CMainDocument::WorkSuspend(std::string& strProjectURL, std::string& strName) {
int iRetVal = 0;
PROJECT* project = state.lookup_project(strProjectURL);
RESULT* pStateResult = state.lookup_result(project, strName);
RESULT* pStateResult = state.lookup_result(strProjectURL, strName);
if (pStateResult) {
iRetVal = rpc.result_op((*pStateResult), "suspend");
} else {
......@@ -1450,8 +1449,7 @@ int CMainDocument::WorkSuspend(std::string& strProjectURL, std::string& strName)
int CMainDocument::WorkResume(std::string& strProjectURL, std::string& strName) {
int iRetVal = 0;
PROJECT* project = state.lookup_project(strProjectURL);
RESULT* pStateResult = state.lookup_result(project, strName);
RESULT* pStateResult = state.lookup_result(strProjectURL, strName);
if (pStateResult) {
iRetVal = rpc.result_op((*pStateResult), "resume");
} else {
......@@ -1715,8 +1713,7 @@ int CMainDocument::WorkShowGraphics(RESULT* result)
int CMainDocument::WorkAbort(std::string& strProjectURL, std::string& strName) {
int iRetVal = 0;
PROJECT* project = state.lookup_project(strProjectURL);
RESULT* pStateResult = state.lookup_result(project, strName);
RESULT* pStateResult = state.lookup_result(strProjectURL, strName);
if (pStateResult) {
iRetVal = rpc.result_op((*pStateResult), "abort");
} else {
......
......@@ -819,18 +819,15 @@ void CViewWork::GetDocApplicationName(wxInt32 item, wxString& strBuffer) const {
RESULT* state_result = NULL;
wxString strAppBuffer = wxEmptyString;
wxString strClassBuffer = wxEmptyString;
PROJECT* project;
wxASSERT(pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
if (result) {
project = pDoc->state.lookup_project(result->project_url);
state_result = pDoc->state.lookup_result(project, result->name);
state_result = pDoc->state.lookup_result(result->project_url, result->name);
if (!state_result) {
pDoc->ForceCacheUpdate();
project = pDoc->state.lookup_project(result->project_url);
state_result = pDoc->state.lookup_result(project, result->name);
state_result = pDoc->state.lookup_result(result->project_url, result->name);
}
wxASSERT(state_result);
......
......@@ -109,8 +109,7 @@ void CViewTabPage::CreatePage()
// Show or don't show the icon if the WU is running
RESULT* resState = NULL;
CMainDocument* pDoc = wxGetApp().GetDocument();
PROJECT* project = pDoc->state.lookup_project(resultWU->project_url);
resState = pDoc->state.lookup_result(project, resultWU->name);
resState = pDoc->state.lookup_result(resultWU->project_url, resultWU->name);
if(resState){
projName = wxString(resState->project->project_name.c_str(), wxConvUTF8 );
if (resState->app->user_friendly_name.size()) {
......@@ -189,8 +188,7 @@ int CViewTabPage::ComputeState() {
void CViewTabPage::LoadSlideShow(std::vector<wxBitmap> *vSlideShow) {
char urlDirectory[256];
CMainDocument* pDoc = wxGetApp().GetDocument();
PROJECT* project = pDoc->state.lookup_project(resultWU->project_url);
RESULT* result = pDoc->state.lookup_result(project, resultWU->name);
RESULT* result = pDoc->state.lookup_result(resultWU->project_url, resultWU->name);
// If result not found then return
if ( result <= 0 ) return;
url_to_project_dir((char *) result->project->master_url.c_str() ,urlDirectory);
......@@ -722,8 +720,7 @@ void WorkunitNotebook::AddTab(RESULT* result) {
RESULT* resState = NULL;
std::string projUrl = result->project_url;
std::string nme = result->name;
PROJECT* project = pDoc->state.lookup_project(projUrl);
resState = pDoc->state.lookup_result(project, nme);
resState = pDoc->state.lookup_result(projUrl, nme);
if(!resState){
pDoc->ForceCacheUpdate();
return;
......
......@@ -166,6 +166,7 @@ class WORKUNIT {
public:
std::string name;
std::string app_name;
int version_num; // backwards compat
double rsc_fpops_est;
double rsc_fpops_bound;
double rsc_memory_bound;
......@@ -325,6 +326,7 @@ public:
APP_VERSION* lookup_app_version(PROJECT*, APP*, int, std::string&);
WORKUNIT* lookup_wu(PROJECT*, std::string&);
RESULT* lookup_result(PROJECT*, std::string&);
RESULT* lookup_result(std::string&, std::string&);
void print();
void clear();
......
......@@ -334,6 +334,7 @@ int WORKUNIT::parse(MIOFILE& in) {
if (match_tag(buf, "</workunit>")) return 0;
if (parse_str(buf, "<name>", name)) continue;
if (parse_str(buf, "<app_name>", app_name)) continue;
if (parse_int(buf, "<version_num>", version_num)) continue;
if (parse_double(buf, "<rsc_fpops_est>", rsc_fpops_est)) continue;
if (parse_double(buf, "<rsc_fpops_bound>", rsc_fpops_bound)) continue;
if (parse_double(buf, "<rsc_memory_bound>", rsc_memory_bound)) continue;
......@@ -345,6 +346,7 @@ int WORKUNIT::parse(MIOFILE& in) {
void WORKUNIT::clear() {
name.clear();
app_name.clear();
version_num = 0;
rsc_fpops_est = 0;
rsc_fpops_bound = 0;
rsc_memory_bound = 0;
......@@ -682,6 +684,16 @@ RESULT* CC_STATE::lookup_result(PROJECT* project, string& str) {
return 0;
}
RESULT* CC_STATE::lookup_result(string& url, string& str) {
unsigned int i;
for (i=0; i<results.size(); i++) {
if (results[i]->project->master_url != url) continue;
if (results[i]->name == str) return results[i];
}
BOINCTRACE("CAN'T FIND RESULT %s\n", str.c_str());
return 0;
}
ALL_PROJECTS_LIST::ALL_PROJECTS_LIST() {
}
......@@ -1096,10 +1108,19 @@ int RPC_CLIENT::get_state(CC_STATE& state) {
result->project = project;
result->wup = state.lookup_wu(project, result->wu_name);
result->app = result->wup->app;
result->avp = state.lookup_app_version(
project, result->app, result->version_num,
result->plan_class
);
APP_VERSION* avp;
if (result->version_num) {
avp = state.lookup_app_version(
project, result->app, result->version_num,
result->plan_class
);
} else {
string empty="";
avp = state.lookup_app_version(
project, result->app, result->wup->version_num, empty
);
}
result->avp = avp;
state.results.push_back(result);
continue;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment