summaryrefslogtreecommitdiffstats
path: root/sd_event_loop.cpp
diff options
context:
space:
mode:
authorVernon Mauery <vernon.mauery@linux.intel.com>2018-11-07 09:55:53 -0800
committerVernon Mauery <vernon.mauery@linux.intel.com>2019-02-25 14:40:59 -0800
commit8d6f200c5fdb820eda8e0ed721e465d544209b23 (patch)
tree377753653691c994f193dccb364e6684b5cf929f /sd_event_loop.cpp
parent7b98c0725eec2a09bf65ee1e78839fc2c4a3da03 (diff)
downloadphosphor-net-ipmid-8d6f200c5fdb820eda8e0ed721e465d544209b23.tar.gz
phosphor-net-ipmid-8d6f200c5fdb820eda8e0ed721e465d544209b23.zip
netipmid: make Handler asynchronous
The dbus call to the main ipmid queue was up to this point synchronous, which means it blocks all other networking and execution until the main queue returns (which may be on the order of seconds for some commands). This is an unacceptable delay, especially when this queue is responsible for timely updates of SOL traffic. This turns the call into an asynchronous one by leveraging shared pointers and an optional action on destruction. So as long as a reference to the Handler object exists, it will live on, waiting to send its response. Once the async dbus call has returned and set the reply in the Handler, it will drop the reference to the shared pointer and the destructor will send out the response over the channel. Tested-by: Run multiple sessions at the same time while monitoring dbus traffic. See that the requests and responses may be interleaved instead of serial. Change-Id: I16fca8dc3d13624eeb1592ec36d1a9af6575f115 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
Diffstat (limited to 'sd_event_loop.cpp')
-rw-r--r--sd_event_loop.cpp19
1 files changed, 2 insertions, 17 deletions
diff --git a/sd_event_loop.cpp b/sd_event_loop.cpp
index 5be974a..8c9abf4 100644
--- a/sd_event_loop.cpp
+++ b/sd_event_loop.cpp
@@ -23,24 +23,9 @@ void EventLoop::handleRmcpPacket()
auto channelPtr = std::make_shared<udpsocket::Channel>(udpSocket);
// Initialize the Message Handler with the socket channel
- auto msgHandler = std::make_shared<message::Handler>(channelPtr);
+ auto msgHandler = std::make_shared<message::Handler>(channelPtr, io);
- // Read the incoming IPMI packet
- std::shared_ptr<message::Message> inMessage(msgHandler->receive());
- if (inMessage == nullptr)
- {
- return;
- }
-
- // Execute the Command
- std::shared_ptr<message::Message> outMessage =
- msgHandler->executeCommand(inMessage);
- if (outMessage == nullptr)
- {
- return;
- }
- // Send the response IPMI Message
- msgHandler->send(outMessage);
+ msgHandler->processIncoming();
}
catch (const std::exception& e)
{
OpenPOWER on IntegriCloud