aboutsummaryrefslogtreecommitdiff
path: root/bbot/agent/agent.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bbot/agent/agent.cxx')
-rw-r--r--bbot/agent/agent.cxx14
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;
}
}