From 14bb4328332998d941ce47d1937306540feca370 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 25 Nov 2019 00:34:51 -0800 Subject: [PATCH] client: send task descriptions if requested by AM --- client/acct_mgr.cpp | 17 +++++++++++++++++ client/acct_mgr.h | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/client/acct_mgr.cpp b/client/acct_mgr.cpp index ff42f0dd35..5c8b519c97 100644 --- a/client/acct_mgr.cpp +++ b/client/acct_mgr.cpp @@ -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("\n"); + gstate.write_tasks_gui(mf, !ami.send_tasks_all); + mf.printf("\n"); + } + fprintf(f, "\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() { diff --git a/client/acct_mgr.h b/client/acct_mgr.h index eee43c5fef..4d6ce022e8 100644 --- a/client/acct_mgr.h +++ b/client/acct_mgr.h @@ -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;