control: Remove the sdevent defer redirect on USR1

The signal handler provided by sdeventplus already calls the provided
callback function from the event loop, there is no need to use a 'defer'
event source that also just calls a function from the event loop.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ie51c6abc9260a8fc43b13844356c62080835ea38
diff --git a/control/json/manager.cpp b/control/json/manager.cpp
index a505fce..147fe9a 100644
--- a/control/json/manager.cpp
+++ b/control/json/manager.cpp
@@ -102,15 +102,8 @@
     }
 }
 
-void Manager::sigUsr1Handler(sdeventplus::source::Signal&,
-                             const struct signalfd_siginfo*)
-{
-    debugDumpEventSource = std::make_unique<sdeventplus::source::Defer>(
-        _event, std::bind(std::mem_fn(&Manager::dumpDebugData), this,
-                          std::placeholders::_1));
-}
-
-void Manager::dumpDebugData(sdeventplus::source::EventBase& /*source*/)
+void Manager::dumpDebugData(sdeventplus::source::Signal&,
+                            const struct signalfd_siginfo*)
 {
     json data;
     FlightRecorder::instance().dump(data);
@@ -128,8 +121,6 @@
     }
 
     file << std::setw(4) << data;
-
-    debugDumpEventSource.reset();
 }
 
 void Manager::dumpCache(json& data)
diff --git a/control/json/manager.hpp b/control/json/manager.hpp
index 5b6aaac..8bb5c35 100644
--- a/control/json/manager.hpp
+++ b/control/json/manager.hpp
@@ -175,8 +175,8 @@
      * @brief Callback function to handle receiving a USR1 signal to dump
      * the flight recorder.
      */
-    void sigUsr1Handler(sdeventplus::source::Signal&,
-                        const struct signalfd_siginfo*);
+    void dumpDebugData(sdeventplus::source::Signal&,
+                       const struct signalfd_siginfo*);
 
     /**
      * @brief Get the active profiles of the system where an empty list
@@ -637,10 +637,6 @@
     /* List of events configured */
     std::map<configKey, std::unique_ptr<Event>> _events;
 
-    /* The sdeventplus wrapper around sd_event_add_defer to dump debug
-     * data from the event loop after the USR1 signal.  */
-    std::unique_ptr<sdeventplus::source::Defer> debugDumpEventSource;
-
     /**
      * @brief A map of parameter names and values that are something
      *        other than just D-Bus property values that other actions
@@ -699,11 +695,6 @@
     void setProfiles();
 
     /**
-     * @brief Callback from debugDumpEventSource to dump debug data
-     */
-    void dumpDebugData(sdeventplus::source::EventBase&);
-
-    /**
      * @brief Dump the _objects, _servTree, and _parameters maps to JSON
      *
      * @param[out] data - The JSON that will be filled in
diff --git a/control/main.cpp b/control/main.cpp
index ae46caa..3596b14 100644
--- a/control/main.cpp
+++ b/control/main.cpp
@@ -104,7 +104,7 @@
         stdplus::signal::block(SIGUSR1);
         sdeventplus::source::Signal sigUsr1(
             event, SIGUSR1,
-            std::bind(&json::Manager::sigUsr1Handler, &manager,
+            std::bind(&json::Manager::dumpDebugData, &manager,
                       std::placeholders::_1, std::placeholders::_2));
 
         phosphor::fan::util::SDBusPlus::getBus().request_name(CONTROL_BUSNAME);