From c6c242220743b37df7f2a7f7426be977919119a1 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 19 Oct 2005 21:04:45 +0000 Subject: [PATCH] be careful deleting project_init.xml svn path=/trunk/boinc/; revision=8705 --- checkin_notes | 10 ++++++++++ client/client_state.C | 15 +-------------- client/gui_rpc_server_ops.C | 14 ++++++++++++++ html/inc/host.inc | 4 +++- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/checkin_notes b/checkin_notes index 888bd02e50..9006fa4248 100755 --- a/checkin_notes +++ b/checkin_notes @@ -13229,3 +13229,13 @@ David 20 Oct 2005 lib/ hostinfo.h + +David 20 Oct 2005 + - core client: delete project_init.xml only on detach via GUI RPC + (not on detach due to initial master file fetch failure) + + client/ + client_state.C + gui_rpc_server_ops.C + html/inc/ + host.inc diff --git a/client/client_state.C b/client/client_state.C index c9e9de1944..b0c38fd87e 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -1324,7 +1324,7 @@ int CLIENT_STATE::detach_project(PROJECT* project) { } } - //delete statistics file + // delete statistics file // get_statistics_filename(project->master_url, path); retval = boinc_delete_file(path); @@ -1344,19 +1344,6 @@ int CLIENT_STATE::detach_project(PROJECT* project) { ); } - // if project_init.xml refers to this project, - // delete the file, otherwise we'll just - // reattach the next time the core client starts - // - if (!strcmp(project->master_url, project_init.url)) { - retval = project_init.remove(); - if (retval) { - msg_printf(project, MSG_ERROR, - "Can't delete project init file: %s\n", boincerror(retval) - ); - } - } - // remove project directory and its contents // retval = remove_project_dir(*project); diff --git a/client/gui_rpc_server_ops.C b/client/gui_rpc_server_ops.C index c8623c142d..5ec3f952d0 100644 --- a/client/gui_rpc_server_ops.C +++ b/client/gui_rpc_server_ops.C @@ -160,6 +160,7 @@ static void handle_result_show_graphics(char* buf, MIOFILE& fout) { static void handle_project_op(char* buf, MIOFILE& fout, const char* op) { + int retval; PROJECT* p = get_project(buf, fout); if (!p) { fout.printf("no such project\n"); @@ -177,6 +178,19 @@ static void handle_project_op(char* buf, MIOFILE& fout, const char* op) { p->suspended_via_gui = false; } else if (!strcmp(op, "detach")) { gstate.detach_project(p); + + // if project_init.xml refers to this project, + // delete the file, otherwise we'll just + // reattach the next time the core client starts + // + if (!strcmp(p->master_url, gstate.project_init.url)) { + retval = gstate.project_init.remove(); + if (retval) { + msg_printf(p, MSG_ERROR, + "Can't delete project init file: %s\n", boincerror(retval) + ); + } + } } else if (!strcmp(op, "update")) { p->sched_rpc_pending = true; p->min_rpc_time = 0; diff --git a/html/inc/host.inc b/html/inc/host.inc index 693370aa89..5404f02059 100644 --- a/html/inc/host.inc +++ b/html/inc/host.inc @@ -110,7 +110,9 @@ function show_host($host, $private, $ipprivate) { row2("Number of times client has contacted server", $host->rpc_seqno); row2("Last time contacted server", time_str($host->rpc_time)); row2("% of time BOINC client is running", 100*$host->on_frac." %"); - row2("While BOINC running, % of time host has an Internet connection", 100*$host->connected_frac." %"); + if ($host->connect_frac > 0) { + row2("While BOINC running, % of time host has an Internet connection", 100*$host->connected_frac." %"); + } row2("While BOINC running, % of time work is allowed", 100*$host->active_frac." %"); if ($host->cpu_efficiency) { row2("Average CPU efficiency", $host->cpu_efficiency);