Remove hostConsole fd from the event loop.
The fd is registered in the sd_event_loop, so as part of cleanup of
the customFD the fd is removed from the event loop.
Change-Id: Idfc07375ae330c82755fb1d08c8f181410cf917f
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/sd_event_loop.cpp b/sd_event_loop.cpp
index af1a5ee..ed3e547 100644
--- a/sd_event_loop.cpp
+++ b/sd_event_loop.cpp
@@ -281,8 +281,6 @@
{
log<level::ERR>("Failed to disable the host console socket",
entry("RC=%d", rc));
- hostConsole.reset();
- throw std::runtime_error("Failed to disable socket descriptor");
}
hostConsole.reset();
diff --git a/sol/sol_manager.cpp b/sol/sol_manager.cpp
index ce0e5a4..8afc932 100644
--- a/sol/sol_manager.cpp
+++ b/sol/sol_manager.cpp
@@ -12,6 +12,16 @@
using namespace phosphor::logging;
+CustomFD::~CustomFD()
+{
+ if(fd >= 0)
+ {
+ // Remove the host console descriptor from the sd_event_loop
+ std::get<eventloop::EventLoop&>(singletonPool).stopHostConsole();
+ close(fd);
+ }
+}
+
void Manager::initHostConsoleFd()
{
struct sockaddr_un addr;
@@ -127,8 +137,6 @@
if (payloadMap.empty())
{
- // Remove the host console decriptor from the sd_event_loop
- std::get<eventloop::EventLoop&>(singletonPool).stopHostConsole();
consoleFD.reset();
}
}
diff --git a/sol/sol_manager.hpp b/sol/sol_manager.hpp
index a7e4a1c..e756574 100644
--- a/sol/sol_manager.hpp
+++ b/sol/sol_manager.hpp
@@ -33,13 +33,7 @@
CustomFD(int fd) :
fd(fd) {}
- ~CustomFD()
- {
- if(fd >=0)
- {
- close(fd);
- }
- }
+ ~CustomFD();
int operator()() const
{