summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Joseph <tomjoseph@in.ibm.com>2017-04-25 17:59:02 +0530
committerTom Joseph <tomjoseph@in.ibm.com>2017-05-08 15:25:04 +0530
commitb81f7617c6646dc36e4a4ad55e9a08cf565896ef (patch)
treeebdfec5e11b4306cd16c66ac50502e665dbc6b4e
parent18a45e9d5dd584b5b1f28e868ec884339516a835 (diff)
downloadphosphor-net-ipmid-b81f7617c6646dc36e4a4ad55e9a08cf565896ef.tar.gz
phosphor-net-ipmid-b81f7617c6646dc36e4a4ad55e9a08cf565896ef.zip
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>
-rw-r--r--sd_event_loop.cpp2
-rw-r--r--sol/sol_manager.cpp12
-rw-r--r--sol/sol_manager.hpp8
3 files changed, 11 insertions, 11 deletions
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 @@ void EventLoop::stopHostConsole()
{
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 @@ namespace sol
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 @@ void Manager::stopPayloadInstance(uint8_t payloadInstance)
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 @@ struct CustomFD
CustomFD(int fd) :
fd(fd) {}
- ~CustomFD()
- {
- if(fd >=0)
- {
- close(fd);
- }
- }
+ ~CustomFD();
int operator()() const
{
OpenPOWER on IntegriCloud