[ipmid]: Advertise D-Bus signals, only when ready

Requesting the bus name & sending out InterfacesAdded signal earlier
causes phosphor-mapper introspect to fail, as ipmi command handler
registration & initialization was in progress before hitting io->run().
Hence moved the code to advertise about D-Bus signal, once ipmid is done
with init & registration. This fixes phosphor-mapper timeout.

Tested:
1. Verified that phosphor-mapper timeout doesn't happen, even when
there is delay in cmd handler registrations etc.

Change-Id: I3bb565c0e39f2604dde30e21b9539ce88b73cb0e
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/ipmid-new.cpp b/ipmid-new.cpp
index 3612884..bb427f7 100644
--- a/ipmid-new.cpp
+++ b/ipmid-new.cpp
@@ -820,7 +820,6 @@
     }
     auto sdbusp = std::make_shared<sdbusplus::asio::connection>(*io, bus);
     setSdBus(sdbusp);
-    sdbusp->request_name("xyz.openbmc_project.Ipmi.Host");
 
     // TODO: Hack to keep the sdEvents running.... Not sure why the sd_event
     //       queue stops running if we don't have a timer that keeps re-arming
@@ -837,13 +836,6 @@
     std::forward_list<ipmi::IpmiProvider> providers =
         ipmi::loadProviders(HOST_IPMI_LIB_PATH);
 
-    // Add bindings for inbound IPMI requests
-    auto server = sdbusplus::asio::object_server(sdbusp);
-    auto iface = server.add_interface("/xyz/openbmc_project/Ipmi",
-                                      "xyz.openbmc_project.Ipmi.Server");
-    iface->register_method("execute", ipmi::executionEntry);
-    iface->initialize();
-
 #ifdef ALLOW_DEPRECATED_API
     // listen on deprecated signal interface for kcs/bt commands
     constexpr const char* FILTER = "type='signal',interface='org.openbmc."
@@ -874,6 +866,14 @@
     registerSignalHandler(ipmi::prioOpenBmcBase, SIGINT, stopAsioRunLoop);
     registerSignalHandler(ipmi::prioOpenBmcBase, SIGTERM, stopAsioRunLoop);
 
+    sdbusp->request_name("xyz.openbmc_project.Ipmi.Host");
+    // Add bindings for inbound IPMI requests
+    auto server = sdbusplus::asio::object_server(sdbusp);
+    auto iface = server.add_interface("/xyz/openbmc_project/Ipmi",
+                                      "xyz.openbmc_project.Ipmi.Server");
+    iface->register_method("execute", ipmi::executionEntry);
+    iface->initialize();
+
     io->run();
 
     // destroy all the IPMI handlers so the providers can unload safely