diff options
author | Tom Joseph <tomjoseph@in.ibm.com> | 2017-03-14 16:14:03 +0530 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-04-24 11:22:15 -0500 |
commit | cfbd43fd472761d0bd886e5e64de9ef0b299b7f4 (patch) | |
tree | 82fc557e4e7f7635fcc80ed9f4b447031f123e87 | |
parent | 28d993a8cf0c00b65642e76771e6e5719c07127e (diff) | |
download | phosphor-net-ipmid-cfbd43fd472761d0bd886e5e64de9ef0b299b7f4.tar.gz phosphor-net-ipmid-cfbd43fd472761d0bd886e5e64de9ef0b299b7f4.zip |
Implement stopHostConsole
stopHostConsole would remove the host console fd from the event loop.
Change-Id: Ie642e7022e7195a7f0f5ec2af38f890cb8fdf524
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
-rw-r--r-- | sd_event_loop.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sd_event_loop.cpp b/sd_event_loop.cpp index 2fc8551..d30aafe 100644 --- a/sd_event_loop.cpp +++ b/sd_event_loop.cpp @@ -197,4 +197,24 @@ void EventLoop::startHostConsole(const sol::CustomFD& fd) source=nullptr; } +void EventLoop::stopHostConsole() +{ + int rc = 0; + + if (hostConsole.get()) + { + // Disable the host console payload + rc = sd_event_source_set_enabled(hostConsole.get(), SD_EVENT_OFF); + if (rc < 0) + { + 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(); + } +} + } // namespace eventloop |