diff --git a/checkin_notes b/checkin_notes index 0312f52dd6..87e6e7ca2d 100755 --- a/checkin_notes +++ b/checkin_notes @@ -2650,12 +2650,12 @@ David 19 Mar 2007 prefs.C,h David 19 Mar 2007 - - compile fixes + - compile fixes - client/ - hostinfo_win.C - win_build/ - boinc_cli_curl.vcproj + client/ + hostinfo_win.C + win_build/ + boinc_cli_curl.vcproj Charlie 19 Mar 2007 - Mac: fix compile errors (must cast double variable to int to use it @@ -2682,10 +2682,10 @@ Charlie 19 Mar 2007 project.pbxproj David 19 Mar 2007 - - core client: bug fixes in prefs + - core client: bug fixes in prefs - lib/ - prefs.C + lib/ + prefs.C Rom 19 Mar 2007 - Add some more cross compiler tweaks to the precompiled header for Windows. @@ -2736,7 +2736,17 @@ David 20 Mar 2007 util.C,h David 20 Mar 2007 - - Manager: cosmetic tweaks to project select + - Manager: cosmetic tweaks to project select - clientgui/ - ProjectListCtrl.cpp + clientgui/ + ProjectListCtrl.cpp + +David 20 Mar 2007 + - core client: if "no more work" or "detach when done" tag + is missing from account manager reply, don't change value. + Note: this is implemented using new + OPTIONAL_BOOL and OPTIONAL_DOUBLE types + that may be useful elsewere as well. + + client/ + acct_mgr.C,h diff --git a/client/acct_mgr.C b/client/acct_mgr.C index db1388cd11..d4982e3885 100644 --- a/client/acct_mgr.C +++ b/client/acct_mgr.C @@ -189,17 +189,18 @@ int ACCT_MGR_OP::do_rpc( int AM_ACCOUNT::parse(XML_PARSER& xp) { char tag[256]; - bool is_tag; + bool is_tag, btemp; int retval; + double dtemp; detach = false; update = false; - dont_request_more_work = false; - detach_when_done = false; + dont_request_more_work.init(); + detach_when_done.init(); url = ""; strcpy(url_signature, ""); authenticator = ""; - resource_share = -1; + resource_share.init(); while (!xp.get(tag, sizeof(tag), is_tag)) { if (!is_tag) { @@ -225,9 +226,15 @@ int AM_ACCOUNT::parse(XML_PARSER& xp) { if (xp.parse_string(tag, "authenticator", authenticator)) continue; if (xp.parse_bool(tag, "detach", detach)) continue; if (xp.parse_bool(tag, "update", update)) continue; - if (xp.parse_bool(tag, "dont_request_more_work", dont_request_more_work)) continue; - if (xp.parse_bool(tag, "detach_when_done", detach_when_done)) continue; - if (xp.parse_double(tag, "resource_share", resource_share)) continue; + if (xp.parse_bool(tag, "dont_request_more_work", btemp)) { + dont_request_more_work.set(btemp); + } + if (xp.parse_bool(tag, "detach_when_done", btemp)) { + detach_when_done.set(btemp); + } + if (xp.parse_double(tag, "resource_share", dtemp)) { + resource_share.set(dtemp); + } } return ERR_XML_PARSE; } @@ -399,8 +406,12 @@ void ACCT_MGR_OP::handle_reply(int http_op_retval) { } else { //msg_printf(pp, MSG_INFO, "Already attached"); pp->attached_via_acct_mgr = true; - pp->dont_request_more_work = acct.dont_request_more_work; - pp->detach_when_done = acct.detach_when_done; + if (acct.dont_request_more_work.present) { + pp->dont_request_more_work = acct.dont_request_more_work.value; + } + if (acct.detach_when_done.present) { + pp->detach_when_done = acct.detach_when_done.value; + } // initiate a scheduler RPC if requested by AMS // @@ -408,8 +419,8 @@ void ACCT_MGR_OP::handle_reply(int http_op_retval) { pp->sched_rpc_pending = RPC_REASON_ACCT_MGR_REQ; pp->min_rpc_time = 0; } - if (acct.resource_share >= 0) { - pp->ams_resource_share = acct.resource_share; + if (acct.resource_share.present) { + pp->ams_resource_share = acct.resource_share.value; pp->resource_share = pp->ams_resource_share; } else { // no host-specific resource share; diff --git a/client/acct_mgr.h b/client/acct_mgr.h index 146342663c..aab0b50909 100644 --- a/client/acct_mgr.h +++ b/client/acct_mgr.h @@ -58,6 +58,20 @@ struct ACCT_MGR_INFO { bool poll(); }; +struct OPTIONAL_BOOL { + bool present; + bool value; + inline void init() {present=false;} + inline void set(bool v) {value=v; present=true;} +}; + +struct OPTIONAL_DOUBLE { + bool present; + double value; + inline void init() {present=false;} + inline void set(double v) {value=v; present=true;} +}; + // stuff after here related to RPCs to account managers struct AM_ACCOUNT { @@ -66,9 +80,9 @@ struct AM_ACCOUNT { char url_signature[MAX_SIGNATURE_LEN]; bool detach; bool update; - bool dont_request_more_work; - bool detach_when_done; - double resource_share; + OPTIONAL_BOOL dont_request_more_work; + OPTIONAL_BOOL detach_when_done; + OPTIONAL_DOUBLE resource_share; int parse(XML_PARSER&); AM_ACCOUNT() {}