From 811feb240cf02ed264003c72cf0aa2e31edf7c78 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 19 May 2017 11:39:26 +0200 Subject: Make TFTP upload even more robust --- bbot/agent.cxx | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/bbot/agent.cxx b/bbot/agent.cxx index 3c7b248..f7bccde 100644 --- a/bbot/agent.cxx +++ b/bbot/agent.cxx @@ -212,7 +212,7 @@ bootstrap_machine (const dir_path& md, // manifest file. // for (to = bootstrap_to; - to != 0 && !file_exists (mf); + to != 0 && (!file_exists (mf) || file_empty (mf)); tftpd.serve (to)) ; if (to == 0) @@ -221,7 +221,7 @@ bootstrap_machine (const dir_path& md, l3 ([&]{trace << "completed bootstrap in " << bootstrap_to - to << "s";}); // The file may have been created but not yet (completely) uploaded. - // So we wait for one second without any TFTP activity. + // So we wait for a one second window without any TFTP activity. // while (tftpd.serve ((to = 1))) ; @@ -513,9 +513,14 @@ try // if (int i = compare_bbot (bmm->bootstrap)) { - assert (i > 0); - l3 ([&]{trace << "ignoring " << tp << ": old bbot";}); - break; + if (i > 0) + { + l3 ([&]{trace << "ignoring " << tp << ": old bbot";}); + break; + } + else + warn << "bootstrapped " << tp << " bbot worker is older " + << "than agent; assuming test setup"; } } else @@ -686,7 +691,13 @@ try // So on our side we serve TFTP requests while checking for the // manifest file. // - for (to = build_to; to != 0 && !file_exists (rf); tftpd.serve (to)) ; + // There are seem to be some "anomalies" in the Windows network stack + // in that we get an empty file and then the upload process gets stuck + // for no apparent reason. + // + for (to = build_to; + to != 0 && (!file_exists (rf) || file_empty (rf)); + tftpd.serve (to)) ; if (to == 0) return soft_fail ("build timeout"); @@ -694,7 +705,7 @@ try l3 ([&]{trace << "completed build in " << build_to - to << "s";}); // The file may have been created but not yet (completely) uploaded. - // So we wait for one second without any TFTP activity. + // So we wait for a one second window without any TFTP activity. // while (tftpd.serve ((to = 1))) ; -- cgit v1.1