aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-10-19 10:46:24 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-10-19 10:46:24 +0200
commit29770a9d660f28522a7ef69e60d1ab827781ef2e (patch)
treeb449d7e444593ded53ea473f6cc3159427d0ca63
parent644f4fac6a06f269e342bac43966f3d400715ef6 (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.
-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 2ad8947..5979ec6 100644
--- a/bbot/worker/worker.cxx
+++ b/bbot/worker/worker.cxx
@@ -353,10 +353,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,
@@ -367,8 +368,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");
}