AMS can tell client to update

svn path=/trunk/boinc/; revision=9682
This commit is contained in:
David Anderson 2006-03-17 20:18:39 +00:00
parent 0c69d7cac0
commit a1ac47381b
5 changed files with 37 additions and 17 deletions

View File

@ -2981,3 +2981,17 @@ Rom 17 Mar 2006
win_build/installerv2 win_build/installerv2
BOINC.ism BOINC.ism
David 17 Mar 2006
- Add optional <update/> tag in <account> elements
of account manager replies.
This tells the core client to do a scheduler RPC to the project.
The account manager should set this when it has updated prefs
and wants the core client to get them;
put <update/> in the <account> element for one of
the projects to which prefs were successfully sent.
client/
acct_mgr.C,h
doc/
acct_mgt.php

View File

@ -166,6 +166,7 @@ int AM_ACCOUNT::parse(FILE* f) {
int retval; int retval;
detach = false; detach = false;
update = false;
url = ""; url = "";
strcpy(url_signature, ""); strcpy(url_signature, "");
authenticator = ""; authenticator = "";
@ -188,6 +189,7 @@ int AM_ACCOUNT::parse(FILE* f) {
} }
if (parse_str(buf, "<authenticator>", authenticator)) continue; if (parse_str(buf, "<authenticator>", authenticator)) continue;
if (parse_bool(buf, "detach", detach)) continue; if (parse_bool(buf, "detach", detach)) continue;
if (parse_bool(buf, "update", update)) continue;
} }
return ERR_XML_PARSE; return ERR_XML_PARSE;
} }
@ -312,30 +314,28 @@ void ACCT_MGR_OP::handle_reply(int http_op_retval) {
} else { } else {
msg_printf(pp, MSG_INFO, "Already attached"); msg_printf(pp, MSG_INFO, "Already attached");
pp->attached_via_acct_mgr = true; pp->attached_via_acct_mgr = true;
// initiate a scheduler RPC if requested by AMS
//
if (acct.update) {
pp->sched_rpc_pending = true;
pp->min_rpc_time = 0;
}
} }
} }
} else { } else {
if (!acct.detach) { if (!acct.detach) {
msg_printf(NULL, MSG_INFO, "Attaching to %s", acct.url.c_str()); msg_printf(NULL, MSG_INFO,
gstate.add_project(acct.url.c_str(), acct.authenticator.c_str(), true); "Attaching to %s", acct.url.c_str()
);
gstate.add_project(
acct.url.c_str(), acct.authenticator.c_str(), true
);
} }
} }
} }
} }
// Do a scheduler RPC to some AMS-managed project,
// to get new preferences if any.
// This is a kludge.
// Would be nice to do this only if prefs have actually changed.
//
for (i=0; i<gstate.projects.size(); i++) {
PROJECT* p = gstate.projects[i];
if (p->attached_via_acct_mgr && p->min_rpc_time==0) {
p->sched_rpc_pending = true;
break;
}
}
strcpy(gstate.acct_mgr_info.previous_host_cpid, gstate.host_info.host_cpid); strcpy(gstate.acct_mgr_info.previous_host_cpid, gstate.host_info.host_cpid);
if (repeat_sec) { if (repeat_sec) {
gstate.acct_mgr_info.next_rpc_time = gstate.now + repeat_sec; gstate.acct_mgr_info.next_rpc_time = gstate.now + repeat_sec;

View File

@ -62,6 +62,7 @@ struct AM_ACCOUNT {
std::string authenticator; std::string authenticator;
char url_signature[MAX_SIGNATURE_LEN]; char url_signature[MAX_SIGNATURE_LEN];
bool detach; bool detach;
bool update;
int parse(FILE*); int parse(FILE*);
AM_ACCOUNT() {} AM_ACCOUNT() {}

View File

@ -239,6 +239,7 @@ f72103eb0995be77cac54f253c0ba639a814d3293646ae11894e9d1367a98790
. .
</url_signature> </url_signature>
<authenticator>KEY</authenticator> <authenticator>KEY</authenticator>
[ <update/> ]
[ <detach/> ] [ <detach/> ]
</account> </account>
... ...
@ -294,6 +295,9 @@ list_item("action",
<dd>The account's authenticator. <dd>The account's authenticator.
<dt>detach <dt>detach
<dd>If present, the client should detach this project. <dd>If present, the client should detach this project.
<dt>update
<dd>If present, the client should contact this project
to get new global preferences.
</dl> </dl>
NOTE: the XML must be as above, with the &lt;url> NOTE: the XML must be as above, with the &lt;url>
and &lt;authenticator> elements on a single line, and &lt;authenticator> elements on a single line,

View File

@ -4,8 +4,9 @@ require_once("boinc_news.inc");
require_once("../html/inc/news.inc"); require_once("../html/inc/news.inc");
$projects = array( $projects = array(
"<a href=http://climateprediction.net>Climateprediction.net</a> "<a href=http://climateprediction.net>Climateprediction.net</a>,
and <a href=http://bbc.cpdn.org>BBC Climate Change Experiment</a>: <a href=http://bbc.cpdn.org>BBC Climate Change Experiment</a>,
and <a href=http://attribution.cpdn.org/>Seasonal Attribution Project</a>:
study climate change.", study climate change.",
"<a href=http://einstein.phys.uwm.edu/>Einstein@home</a>: "<a href=http://einstein.phys.uwm.edu/>Einstein@home</a>:
search for gravitational signals emitted by pulsars.", search for gravitational signals emitted by pulsars.",