- client: fix my last checkin

svn path=/trunk/boinc/; revision=20296
This commit is contained in:
David Anderson 2010-01-28 13:29:10 +00:00
parent 703a496091
commit 86ccb6eed3
3 changed files with 32 additions and 2 deletions

View File

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

View File

@ -209,7 +209,12 @@ int PROJECT::parse_state(MIOFILE& in) {
// not authoritative
if (parse_double(buf, "<duration_correction_factor>", duration_correction_factor)) continue;
if (parse_bool(buf, "attached_via_acct_mgr", attached_via_acct_mgr)) continue;
if (parse_double(buf, "<ams_resource_share>", ams_resource_share)) continue;
// backwards compat - old state files had ams_resource_share = 0
if (parse_double(buf, "<ams_resource_share_new>", ams_resource_share)) continue;
if (parse_double(buf, "<ams_resource_share>", 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?" <use_symlinks/>\n":""
);
if (ams_resource_share >= 0) {
out.printf(" <ams_resource_share>%f</ams_resource_share>\n",
out.printf(" <ams_resource_share_new>%f</ams_resource_share_new>\n",
ams_resource_share
);
}

View File

@ -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; i<projects.size(); i++) {
x += projects[i]->resource_share;
}
if (!x) {
msg_printf(NULL, MSG_USER_ALERT,
"All projects have zero resource share; setting to 100"
);
for (i=0; i<projects.size(); i++) {
projects[i]->resource_share = 100;
}
}
}
return 0;
}