dbus-name: do startup work before registering name

The following commit aggravated an existing issue within OpenBMC
software:

https://gerrit.openbmc-project.xyz/c/openbmc/meta-phosphor/+/26476

A busctl pcap of the failure shows mapper trying to introspect the
dbus monitor while the dbus monitor is trying to set itself up to
monitor its defined dbus events. This includes calls into mapper and
inventory manager.

This results in a timeout on the mapper side and the dbus monitor object
never being stored within mapper.

The above commit appears to aggravate this bug by allowing mapper to
start introspecting the dbus monitor sooner then it normally does.

Tested:
Verified with this fix that the issue, which was 100% recreatable prior
to this change, did not recreate with multiple BMC reboots

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I6c9380af8b7331bbdbbee0ea3bd0b5ff17dc4187
diff --git a/src/main.cpp b/src/main.cpp
index 29db39a..2686056 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -32,7 +32,6 @@
 
     // Add sdbusplus Object Manager for the 'root' path of events.
     sdbusplus::server::manager::manager objManager(bus, OBJ_EVENT);
-    bus.request_name(BUSNAME_EVENT);
 
     phosphor::events::getManager().restore();
 
@@ -55,6 +54,7 @@
         watch->callback(Context::START);
     }
 
+    bus.request_name(BUSNAME_EVENT);
     bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
     return event.loop();
 }