summaryrefslogtreecommitdiffstats
path: root/sd_event_loop.cpp
Commit message (Collapse)AuthorAgeFilesLines
* netipmid: Remove unused event referencesVernon Mauery2019-02-251-3/+0
| | | | | | | | | | Now that all the provider libraries are only loaded by the main ipmid queue, there are no callers for the event object, so it can be removed. The same goes for the event loop; all users of the sd_event object have been replaced with boost::asio, so it can be removed. Change-Id: Id271c4960a2c5386d6163cc9baecdc368e5e328f Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* netipmid: make Handler asynchronousVernon Mauery2019-02-251-17/+2
| | | | | | | | | | | | | | | | | | | | | | 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>
* netipmid: move sol timers to asioVernon Mauery2019-02-011-230/+0
| | | | | | | | | The IPMI SOL console was using sd_event-based timers directly (without any abstraction). This moves to a much higher level abstraction that is very easy to use: asio timers. Change-Id: Id5df76a1918cdfae420e01884d664234810b7abd Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* netipmid: move sol console sockets to asioVernon Mauery2019-02-011-83/+0
| | | | | | | | Rewrite the SOL console sockets use boost::asio. This reduces code size and ties better into the main asio io loop. Change-Id: Ia79b9aa3fa3c7ce1ddd9b609b032160a88394f8c Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* netipmid: move raw sockets to boost::asio socketsVernon Mauery2019-02-011-58/+45
| | | | | | | | Replacing the raw socket code with boost::asio sockets once again provides a simple API with fewer lines of code. Change-Id: Ibdd4b5ecbead947128200f17025c351d9b3ec859 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* netipmid: use boost::asio signal handlingVernon Mauery2018-12-191-32/+8
| | | | | | | | | boost::asio provides a signal handling interface that looks familiar to the rest of its async API. This will allow the event loop to cleanly shut down upon receipt of SIGTERM or SIGINT. Change-Id: I6a888a0bb0206e885da9e0fcf4856b96ec93a461 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* netipmid: move event loop to boost::asio::io_contextVernon Mauery2018-12-111-32/+17
| | | | | | | | | | Replacing the event loop with asio provides for more flexibility and less code than the sd_event model. Intially, this will require the loop to handle both sd_events with a wrapper, but after all the sd_event sources are replaced with asio event sources the wrapper can be removed. Change-Id: Icf020c6c26a214bb1239641733c89603501c0c49 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* netipmid: use shared_ptr on messages instead of unique_ptr+referencesVernon Mauery2018-11-211-5/+3
| | | | | | | | | | Messages were being created and held by unique_ptr objects and then shared via reference. This is dangerous and sidesteps the whole point of a unique_ptr, which is to enforce single ownership. This replaces the usage with a shared_ptr, which denotes shared ownership. Change-Id: I19ed2693f5a0f5ce47d720ed255fa05bdf3844f8 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* style: cppcheck cleanupPatrick Venture2018-11-081-12/+10
| | | | | | | | | | | | | | | | | | | [command/guid.cpp:37]: (style) The scope of the variable 'rc' can be reduced. [socket_channel.hpp:44]: (performance) Variable 'timeout' is assigned in constructor body. Consider performing initialization in initialization list. [sd_event_loop.cpp:107]: (style) The scope of the variable 'instance' can be reduced. [sd_event_loop.cpp:108]: (style) The scope of the variable 'rc' can be reduced. [sd_event_loop.cpp:142]: (style) The scope of the variable 'instance' can be reduced. [sd_event_loop.cpp:304]: (style) The scope of the variable 'rc' can be reduced. Change-Id: Id090cb217ea7ed9019f1b8d39ebebd6bb73113b1 Signed-off-by: Patrick Venture <venture@google.com>
* netipmid: apply clang-format rulesVernon Mauery2018-11-021-67/+55
| | | | | | | | Lots of whitespace change. Let clang-format do its job and keep the code looking nice. Change-Id: Idfcad1a99cab8170d55a06163de8ad3f420b68b7 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Create sd_event outside from EventLoopRatan Gupta2018-03-271-8/+2
| | | | | | | | | | | | | | | Presently timer in the provider library needs the sd_event and sd_event gets created in the startEventLoop. RegisterCallbackHandlers gets called before the startEventLoop hence not getting the event. This commit creates the sd_event outside from the sd_event_loop and pass the sd_event reference to the startEventLoop function. Tested: run the fru print in net-ipmid context. Change-Id: I2b227154ba60e56d7faa6c8000c20a5231c4417c Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Adding the capability to run netipmid outside of systemdDave Cobbley2017-11-161-3/+31
| | | | | | | | | | | Currently, this application relies upon systemd handing it a socket from the phosphor-ipmi-net.socket file. If for whatever reason, you want to run this application manually (perhaps debugging), it needs to create its own socket. This should have no affect on the normal operation of netipmid. Change-Id: I4e46b586b09cb57d5ef1d2fd0e216552da388381 Signed-off-by: David Cobbley <david.j.cobbley@linux.intel.com>
* Update Journal Variable NamesGunnar Mills2017-10-251-7/+7
| | | | | | | | Journal entry variable names should be uppercase. https://www.freedesktop.org/software/systemd/man/sd_journal_print.html Change-Id: Id7a3f72b5079302759e0855665d241f1f28d9544 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* attach the sd bus to sd_event to receive signalsMarri Devender Rao2017-07-191-0/+8
| | | | | | | | Registering for property change signals for FRU inventory data so notification is required. Change-Id: I2dfee62d32b5b0726faa4643ee1efe9718424a61 Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
* Remove hostConsole fd from the event loop.Tom Joseph2017-05-081-2/+0
| | | | | | | | 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>
* Add resendPayload functionTom Joseph2017-04-241-2/+2
| | | | | | | Resolves openbmc/openbmc#856 Change-Id: I957ce889500840c067e97537e825571cfb77e1c4 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Implement API to send SOL payload when console data is availableTom Joseph2017-04-241-1/+10
| | | | | Change-Id: I7869d389b589c59e0c76000da9bfd72b9e67c064 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Implement stopSOLPayloadInstanceTom Joseph2017-04-241-0/+39
| | | | | | | This API would stop a SOL payload instance timer event sources. Change-Id: Iab98def9975ae808bf41416c7a50977d6e3e7640 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Implement startSOLPayloadInstanceTom Joseph2017-04-241-0/+142
| | | | | | | | This API would register the character accumulate interval and retry interval timer sources for the SOL Payload instance. Change-Id: I76a3aba110b45e99dfdd99354a1376d5248ae508 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Defintion of switchTimerTom Joseph2017-04-241-0/+54
| | | | | | | | switchTimer is used to enable or disable the character accumulate timer or the retry timer. Change-Id: Ica311650f9c4e723bccdcaeb952d9ec080c06d9a Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Implement stopHostConsoleTom Joseph2017-04-241-0/+20
| | | | | | | stopHostConsole would remove the host console fd from the event loop. Change-Id: Ie642e7022e7195a7f0f5ec2af38f890cb8fdf524 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Implement startHostConsoleTom Joseph2017-04-241-0/+67
| | | | | | | | startHostConsole function would add the Host Console fd to the event loop for EPOLLIN and update the console buffer. Change-Id: Icac2955dc84f108b5d819df0a015f9eac7301b42 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Implement startEventLoop and handler function for IPMI packetsTom Joseph2017-04-241-0/+133
The startEventLoop would start the sd_event_loop and register the handler for IPMI incoming packets on UDP standard port 623. Change-Id: Ia8ff44961686c1bf715413ff58bd60d7c71f1be1 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
OpenPOWER on IntegriCloud