aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bbot/agent/agent.cxx22
1 files changed, 15 insertions, 7 deletions
diff --git a/bbot/agent/agent.cxx b/bbot/agent/agent.cxx
index be3b706..83db6d7 100644
--- a/bbot/agent/agent.cxx
+++ b/bbot/agent/agent.cxx
@@ -263,7 +263,7 @@ bootstrap_machine (const dir_path& md,
break;
if (!check_machine ())
- return r;
+ return nullopt;
}
// This can mean two things: machine mis-configuration or what we
@@ -301,6 +301,14 @@ bootstrap_machine (const dir_path& md,
if (tftpd.serve (to, 2))
continue;
+ if (!check_machine ())
+ {
+ // The exit/upload is racy so we re-check.
+ //
+ if (!(file_not_empty (mf) || file_not_empty (mfo)))
+ return nullopt;
+ }
+
bool old (false);
if (file_not_empty (mf) || (old = file_not_empty (mfo)))
{
@@ -313,9 +321,6 @@ bootstrap_machine (const dir_path& md,
if (!tftpd.serve (to, 5))
break;
}
-
- if (!check_machine ())
- return nullopt;
}
if (to == 0)
@@ -981,14 +986,17 @@ try
if (tftpd.serve (to, 2))
continue;
+ if (!check_machine ())
+ {
+ if (!file_not_empty (rf))
+ return r;
+ }
+
if (file_not_empty (rf))
{
if (!tftpd.serve (to, 5))
break;
}
-
- if (!check_machine ())
- return r;
}
if (to == 0)