tools/progress: Add finish and abort functions
We have external progress handlers which would like to implement these
functions, in order to update the screen upon completion or error.
Change-Id: I2df4654d5e2092407a83d2c8bbb020dcce84ac50
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/tools/net.cpp b/tools/net.cpp
index 1c7a407..f6a44d8 100644
--- a/tools/net.cpp
+++ b/tools/net.cpp
@@ -91,6 +91,7 @@
{
std::fprintf(stderr, "Couldn't parse address %s with port %s: %s\n",
host.c_str(), port.c_str(), gai_strerror(ret));
+ progress->abort();
return false;
}
@@ -111,6 +112,7 @@
if (addr == nullptr)
{
std::fprintf(stderr, "Failed to connect\n");
+ progress->abort();
return false;
}
}
@@ -127,6 +129,7 @@
{
std::fprintf(stderr, "Failed to send data to BMC: %s\n",
strerror(errno));
+ progress->abort();
return false;
}
else if (bytesSent > 0)
@@ -147,9 +150,11 @@
}
catch (const ipmiblob::BlobException& b)
{
+ progress->abort();
return false;
}
+ progress->finish();
return true;
}