fanctl: Add timeout to dump

Fix an old TODO and only wait for a fan control dump to complete for
30s.  This is over the 25s default D-Bus timeout in case fan control is
hung up on some D-Bus call.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I30c90ce0ada99d2abe304c66db9ee8de433bc7b6
diff --git a/control/fanctl.cpp b/control/fanctl.cpp
index 4479db1..39eb4e1 100644
--- a/control/fanctl.cpp
+++ b/control/fanctl.cpp
@@ -545,6 +545,8 @@
                               "KillUnit", phosphorServiceName, "main", SIGUSR1);
 
         bool done = false;
+        size_t tries = 0;
+        const size_t maxTries = 30;
 
         do
         {
@@ -559,10 +561,13 @@
                     done = true;
                 }
                 catch (...)
-                {
-                    // TODO: maybe have a max-retries counter and fail after N
-                    // tries
-                }
+                {}
+            }
+
+            if (++tries > maxTries)
+            {
+                std::cerr << "Timed out waiting for fan control dump.\n";
+                return;
             }
         } while (!done);