aboutsummaryrefslogtreecommitdiff
path: root/bbot
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-10-19 10:46:24 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-10-27 15:49:45 +0200
commit68b79c233c2371796c28ea6fdb595f091537d515 (patch)
tree6878a40977cb3a114e72ccfbd14e3417d5686aa8 /bbot
parent994665e567e2538f57de9474f498cfa0095a0050 (diff)
Reimplement worker result manifest upload via temporary file
This is part of the ongoing work to get rid of the intermittent broken pipe errors.
Diffstat (limited to 'bbot')
-rw-r--r--bbot/worker/worker.cxx32
1 files changed, 30 insertions, 2 deletions
diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx
index 5415a9a..4f3e5ad 100644
--- a/bbot/worker/worker.cxx
+++ b/bbot/worker/worker.cxx
@@ -306,10 +306,11 @@ static void
upload_manifest (tracer& trace,
const string& url,
const T& m,
- const char* what)
+ const string& what)
{
try
{
+#if 0
tftp_curl c (trace,
path ("-"),
nullfd,
@@ -320,8 +321,35 @@ upload_manifest (tracer& trace,
manifest_serializer s (c.out, url);
m.serialize (s);
-
c.out.close ();
+#else
+ auto_rmfile tmp;
+ try
+ {
+ tmp = auto_rmfile (path::temp_path (what + "-manifest"));
+ ofdstream ofs (tmp.path);
+ manifest_serializer s (ofs, tmp.path.string ());
+ m.serialize (s);
+ ofs.close ();
+ }
+ catch (const io_error& e) // In case not derived from system_error.
+ {
+ fail << "unable to save " << what << " manifest: " << e;
+ }
+ catch (const system_error& e)
+ {
+ fail << "unable to save " << what << " manifest: " << e;
+ }
+
+ tftp_curl c (trace,
+ tmp.path,
+ nullfd,
+ curl::put,
+ url,
+ "--tftp-blksize", tftp_blksize,
+ "--max-time", tftp_put_timeout);
+#endif
+
if (!c.wait ())
throw_generic_ios_failure (EIO, "non-zero curl exit code");
}