handler: Support more retry logic
Add retry logic for more methods that may fail due to unstable
ipmi interfaces. Also added one seconds sleep in between retries to
allow some time for the interface to be initialized.
Tested: Updated BMC firmware with the new tool and didn't have any
regression.
Change-Id: Ifc4155dd895f1a654da9e03f17e4c1e8613c9133
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/tools/interface.hpp b/tools/interface.hpp
index c613f0e..bd19484 100644
--- a/tools/interface.hpp
+++ b/tools/interface.hpp
@@ -3,8 +3,10 @@
#include "flags.hpp"
#include "progress.hpp"
+#include <chrono>
#include <cstdint>
#include <string>
+#include <thread>
namespace host_tool
{
@@ -26,6 +28,11 @@
virtual bool sendContents(const std::string& input,
std::uint16_t session) = 0;
+ virtual void waitForRetry()
+ {
+ std::this_thread::sleep_for(std::chrono::seconds(1));
+ }
+
/**
* Return the supported data interface for this.
*