summaryrefslogtreecommitdiff
path: root/redfish-core/include/event_service_manager.hpp
diff options
context:
space:
mode:
authorSunitha Harish <sunharis@in.ibm.com>2021-10-26 11:10:04 +0300
committerEd Tanous <ed@tanous.net>2021-11-18 20:33:46 +0300
commit7adb85ac3eafe6a0a63506e6d78d487581c69ded (patch)
tree2969e8c2582bc4e8450a6af2fdedf8f0d55eb4bc /redfish-core/include/event_service_manager.hpp
parent308f70c77194b891c97e6f56c50adee4f39f0de7 (diff)
downloadbmcweb-7adb85ac3eafe6a0a63506e6d78d487581c69ded.tar.xz
EventService: Pass httpHeaders to subscriber
Custom http headers provided by the subscriber was not passed on to the http client request header This commit passes the http headers to the Subscriber constructor Tested by: Subscribe to events with custom headers Verify the event request packet sending the custom header to the subscriber Verified persistency of the subscription Signed-off-by: Sunitha Harish <sunharis@in.ibm.com> Change-Id: I9a4f59b6e9477fae96b380565885f4ac51e2a628
Diffstat (limited to 'redfish-core/include/event_service_manager.hpp')
-rw-r--r--redfish-core/include/event_service_manager.hpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index b501265a17..010c991176 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -383,9 +383,7 @@ class Subscription : public persistent_data::UserSubscription
eventSeqNum(1),
host(inHost), port(inPort), path(inPath), uriProto(inUriProto)
{
- conn = std::make_shared<crow::HttpClient>(
- crow::connections::systemBus->get_io_context(), id, host, port,
- path, httpHeaders);
+ // Subscription constructor
}
Subscription(const std::shared_ptr<boost::beast::tcp_stream>& adaptor) :
@@ -398,12 +396,17 @@ class Subscription : public persistent_data::UserSubscription
void sendEvent(const std::string& msg)
{
- if (conn != nullptr)
+ if (conn == nullptr)
{
- conn->sendData(msg);
- this->eventSeqNum++;
+ // create the HttpClient connection
+ conn = std::make_shared<crow::HttpClient>(
+ crow::connections::systemBus->get_io_context(), id, host, port,
+ path, httpHeaders);
}
+ conn->sendData(msg);
+ eventSeqNum++;
+
if (sseConn != nullptr)
{
sseConn->sendData(eventSeqNum, msg);