client: send task descriptions if requested by AM

This commit is contained in:
David Anderson 2019-11-25 00:34:51 -08:00
parent eca9106002
commit 14bb432833
2 changed files with 24 additions and 0 deletions

View File

@ -251,6 +251,15 @@ int ACCT_MGR_OP::do_rpc(ACCT_MGR_INFO& _ami, bool _via_gui) {
}
gstate.time_stats.write(mf, true);
gstate.net_stats.write(mf);
// send task descriptions if requested by AM
//
if (ami.send_tasks_all || ami.send_tasks_active) {
mf.printf("<results>\n");
gstate.write_tasks_gui(mf, !ami.send_tasks_all);
mf.printf("</results>\n");
}
fprintf(f, "</acct_mgr_request>\n");
fclose(f);
snprintf(buf, sizeof(buf), "%srpc.php", ami.master_url);
@ -388,6 +397,8 @@ int ACCT_MGR_OP::parse(FILE* f) {
safe_strcpy(ami.opaque, "");
ami.no_project_notices = false;
ami.dynamic = false;
ami.send_tasks_all = false;
ami.send_tasks_active = false;
rss_feeds.clear();
if (!xp.parse_start("acct_mgr_reply")) return ERR_XML_PARSE;
while (!xp.get_tag()) {
@ -416,6 +427,8 @@ int ACCT_MGR_OP::parse(FILE* f) {
if (xp.parse_string("error_msg", error_str)) continue;
if (xp.parse_double("repeat_sec", repeat_sec)) continue;
if (xp.parse_bool("dynamic", ami.dynamic)) continue;
if (xp.parse_bool("send_tasks_active", ami.send_tasks_active)) continue;
if (xp.parse_bool("send_tasks_all", ami.send_tasks_all)) continue;
if (xp.parse_string("message", message)) {
msg_printf(NULL, MSG_INFO, "Account manager: %s", message.c_str());
continue;
@ -627,6 +640,8 @@ void ACCT_MGR_OP::handle_reply(int http_op_retval) {
safe_strcpy(gstate.acct_mgr_info.authenticator, ami.authenticator);
gstate.acct_mgr_info.no_project_notices = ami.no_project_notices;
gstate.acct_mgr_info.dynamic = ami.dynamic;
gstate.acct_mgr_info.send_tasks_active = ami.send_tasks_active;
gstate.acct_mgr_info.send_tasks_all = ami.send_tasks_all;
// process projects
//
@ -937,6 +952,8 @@ void ACCT_MGR_INFO::clear() {
starved_rpc_backoff = 0;
starved_rpc_min_time = 0;
dynamic = false;
send_tasks_active = false;
send_tasks_all = false;
}
ACCT_MGR_INFO::ACCT_MGR_INFO() {

View File

@ -31,6 +31,11 @@
// represents an account manager account to which
// we're attached or potentially attached.
// Info stored in acct_mgr_url.xml and acct_mgr_login.xml
//
// If you add stuff here, add code to
// - ACCT_MGR_INFO::clear()
// - ACCT_MGR_OP::parse()
// - ACCT_MGR_OP::handle_reply()
struct ACCT_MGR_INFO : PROJ_AM {
// the following used to be std::string but there
@ -61,6 +66,8 @@ struct ACCT_MGR_INFO : PROJ_AM {
// in AM RPCs (used for "farm management")
bool no_project_notices;
// if set, don't show notices from projects
bool send_tasks_all;
bool send_tasks_active;
// TODO: get rid of the following here and in the manager
bool cookie_required;