From 86ccb6eed36aec51d4611869a86ce8a1066eb3c4 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 28 Jan 2010 13:29:10 +0000 Subject: [PATCH] - client: fix my last checkin svn path=/trunk/boinc/; revision=20296 --- checkin_notes | 7 +++++++ client/client_types.cpp | 9 +++++++-- client/cs_statefile.cpp | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/checkin_notes b/checkin_notes index b4acba2c3a..de4f4b6952 100644 --- a/checkin_notes +++ b/checkin_notes @@ -782,3 +782,10 @@ Charlie 28 Jan 2010 SetupSecurity.cpp mac_build/ Mac_SA_Secure.sh + +David 28 Jan 2010 + - client: fix my last checkin + + client/ + client_types.cpp + cs_statefile.cpp diff --git a/client/client_types.cpp b/client/client_types.cpp index 7d4f78a4ad..a40e4498fa 100644 --- a/client/client_types.cpp +++ b/client/client_types.cpp @@ -209,7 +209,12 @@ int PROJECT::parse_state(MIOFILE& in) { // not authoritative if (parse_double(buf, "", duration_correction_factor)) continue; if (parse_bool(buf, "attached_via_acct_mgr", attached_via_acct_mgr)) continue; - if (parse_double(buf, "", ams_resource_share)) continue; + // backwards compat - old state files had ams_resource_share = 0 + if (parse_double(buf, "", ams_resource_share)) continue; + if (parse_double(buf, "", x)) { + if (x > 0) ams_resource_share = x; + continue; + } if (parse_bool(buf, "scheduler_rpc_in_progress", btemp)) continue; if (parse_bool(buf, "use_symlinks", use_symlinks)) continue; if (log_flags.unparsed_xml) { @@ -319,7 +324,7 @@ int PROJECT::write_state(MIOFILE& out, bool gui_rpc) { use_symlinks?" \n":"" ); if (ams_resource_share >= 0) { - out.printf(" %f\n", + out.printf(" %f\n", ams_resource_share ); } diff --git a/client/cs_statefile.cpp b/client/cs_statefile.cpp index deb109d97e..f15d065484 100644 --- a/client/cs_statefile.cpp +++ b/client/cs_statefile.cpp @@ -490,6 +490,24 @@ int CLIENT_STATE::parse_state_file() { } sort_results(); fclose(f); + + // if total resource share is zero, set all shares to 1 + // + if (projects.size()) { + unsigned int i; + double x=0; + for (i=0; iresource_share; + } + if (!x) { + msg_printf(NULL, MSG_USER_ALERT, + "All projects have zero resource share; setting to 100" + ); + for (i=0; iresource_share = 100; + } + } + } return 0; }