diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-09-19 15:26:43 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-09-19 15:26:43 +0300 |
commit | e62ff8b6f68af6d7b70a8482839ab81a732fd6ac (patch) | |
tree | 3abf6f970f011c7493cf74c4f0382b17438c4b9d | |
parent | 6faf0a374017386b4e662f640a1a2facf782d9e9 (diff) |
Fix agent to always skip invalid task response
-rw-r--r-- | bbot/agent/agent.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/bbot/agent/agent.cxx b/bbot/agent/agent.cxx index bc0b0c3..4760578 100644 --- a/bbot/agent/agent.cxx +++ b/bbot/agent/agent.cxx @@ -1046,6 +1046,8 @@ try { for (const string& u: controllers) { + task_response_manifest r; + try { http_curl c (trace, @@ -1075,7 +1077,7 @@ try if (!f) try { - tr = parse_manifest<task_response_manifest> ( + r = parse_manifest<task_response_manifest> ( c.in, u, "task response", false); } catch (const failed&) {f = true;} @@ -1091,20 +1093,22 @@ try continue; } - if (tr.challenge && !fingerprint) // Controller misbehaves. + if (r.challenge && !fingerprint) // Controller misbehaves. { - error << "unexpected challenge from " << u << ": " << *tr.challenge; + error << "unexpected challenge from " << u << ": " << *r.challenge; continue; } - if (!tr.session.empty ()) // Got a task. + if (!r.session.empty ()) // Got a task. { url = u; - task_manifest& t (*tr.task); + const task_manifest& t (*r.task); l2 ([&]{trace << "task for " << t.name << '/' << t.version << " " << "on " << t.machine << " " << "from " << url;}); + + tr = move (r); break; } } |