re-register LPC-Snoop into event loop

- According to commit 2a744b2d7, LPC-Snoop needs to be registered
  into event loop, so that it can record post code.
  But in commit 0269eaf36, the reporterSource was became a local
  variable in IF-ELSE which cause LPC-Snoop didn't be register into
  event loop.

refs:
https://github.com/openbmc/phosphor-host-postd/commit/2a744b2d70ce9de8519a7c716da5009cb049db17
https://github.com/openbmc/phosphor-host-postd/commit/0269eaf36dcb486b6ac92326fa59f61c267ce7f8

TEST:
root@gsz:/lib/systemd/system# journalctl -u lpcsnoop.service
Jan 01 00:00:24 gsz systemd[1]: Started LPC Snoop Daemon.
Jan 01 00:01:05 gsz snoopd[288]: Code: 0x1
Jan 01 00:01:05 gsz snoopd[288]: Code: 0x2
Jan 01 00:01:05 gsz snoopd[288]: Code: 0x2
Jan 01 00:01:05 gsz snoopd[288]: Code: 0x3
Jan 01 00:01:05 gsz snoopd[288]: Code: 0x3
Jan 01 00:01:05 gsz snoopd[288]: Code: 0x4
Jan 01 00:01:05 gsz snoopd[288]: Code: 0x4
Jan 01 00:01:07 gsz snoopd[288]: Code: 0x5
Jan 01 00:01:07 gsz snoopd[288]: Code: 0x6
Jan 01 00:01:08 gsz snoopd[288]: Code: 0x5
Jan 01 00:01:11 gsz snoopd[288]: Code: 0x0
Jan 01 00:01:11 gsz snoopd[288]: Code: 0x2
Jan 01 00:01:11 gsz snoopd[288]: Code: 0x7f
Jan 01 00:01:17 gsz snoopd[288]: Code: 0x48
Jan 01 00:01:17 gsz snoopd[288]: Code: 0xe
Jan 01 00:01:17 gsz snoopd[288]: Code: 0x49
Jan 01 00:01:17 gsz snoopd[288]: Code: 0x4a

Signed-off-by: Harvey.Wu <Harvey.Wu@quantatw.com>
Change-Id: I15b50e4c5e84778c2d918ba34345dd15036157ac
diff --git a/main.cpp b/main.cpp
index 7886b75..fce2a8f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -322,10 +322,10 @@
     try
     {
         sdeventplus::Event event = sdeventplus::Event::get_default();
+        std::optional<sdeventplus::source::IO> reporterSource;
         if (postFd > 0)
         {
-
-            sdeventplus::source::IO reporterSource(
+            reporterSource.emplace(
                 event, postFd, EPOLLIN | EPOLLET,
                 std::bind_front(PostCodeEventHandler, &reporter, verbose));
         }