summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--http/routing/sserule.hpp8
-rw-r--r--http/server_sent_event.hpp9
-rw-r--r--redfish-core/include/event_service_manager.hpp5
-rw-r--r--test/http/server_sent_event_test.cpp2
4 files changed, 15 insertions, 9 deletions
diff --git a/http/routing/sserule.hpp b/http/routing/sserule.hpp
index 1a422a8268..c0a4e504b3 100644
--- a/http/routing/sserule.hpp
+++ b/http/routing/sserule.hpp
@@ -31,7 +31,7 @@ class SseSocketRule : public BaseRule
}
#ifndef BMCWEB_ENABLE_SSL
- void handleUpgrade(const Request& req,
+ void handleUpgrade(const Request& /*req*/,
const std::shared_ptr<bmcweb::AsyncResp>& /*asyncResp*/,
boost::asio::ip::tcp::socket&& adaptor) override
{
@@ -39,11 +39,11 @@ class SseSocketRule : public BaseRule
crow::sse_socket::ConnectionImpl<boost::asio::ip::tcp::socket>>
myConnection = std::make_shared<
crow::sse_socket::ConnectionImpl<boost::asio::ip::tcp::socket>>(
- *req.ioService, std::move(adaptor), openHandler, closeHandler);
+ std::move(adaptor), openHandler, closeHandler);
myConnection->start();
}
#else
- void handleUpgrade(const Request& req,
+ void handleUpgrade(const Request& /*req*/,
const std::shared_ptr<bmcweb::AsyncResp>& /*asyncResp*/,
boost::beast::ssl_stream<boost::asio::ip::tcp::socket>&&
adaptor) override
@@ -52,7 +52,7 @@ class SseSocketRule : public BaseRule
boost::beast::ssl_stream<boost::asio::ip::tcp::socket>>>
myConnection = std::make_shared<crow::sse_socket::ConnectionImpl<
boost::beast::ssl_stream<boost::asio::ip::tcp::socket>>>(
- *req.ioService, std::move(adaptor), openHandler, closeHandler);
+ std::move(adaptor), openHandler, closeHandler);
myConnection->start();
}
#endif
diff --git a/http/server_sent_event.hpp b/http/server_sent_event.hpp
index a8bccdb450..0e1cd62a9d 100644
--- a/http/server_sent_event.hpp
+++ b/http/server_sent_event.hpp
@@ -18,7 +18,7 @@ namespace crow
namespace sse_socket
{
-struct Connection : std::enable_shared_from_this<Connection>
+struct Connection : public std::enable_shared_from_this<Connection>
{
public:
Connection() = default;
@@ -38,11 +38,13 @@ template <typename Adaptor>
class ConnectionImpl : public Connection
{
public:
- ConnectionImpl(boost::asio::io_context& ioIn, Adaptor&& adaptorIn,
+ ConnectionImpl(Adaptor&& adaptorIn,
std::function<void(Connection&)> openHandlerIn,
std::function<void(Connection&)> closeHandlerIn) :
adaptor(std::move(adaptorIn)),
- ioc(ioIn), timer(ioc), openHandler(std::move(openHandlerIn)),
+ timer(static_cast<boost::asio::io_context&>(
+ adaptor.get_executor().context())),
+ openHandler(std::move(openHandlerIn)),
closeHandler(std::move(closeHandlerIn))
{
@@ -276,7 +278,6 @@ class ConnectionImpl : public Connection
using BodyType = bmcweb::HttpBody;
boost::beast::http::response<BodyType> res;
std::optional<boost::beast::http::response_serializer<BodyType>> serializer;
- boost::asio::io_context& ioc;
boost::asio::steady_timer timer;
bool doingWrite = false;
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index cac6b8b2b2..679c4f6918 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -532,6 +532,11 @@ class Subscription : public persistent_data::UserSubscription
void updateRetryConfig(uint32_t retryAttempts,
uint32_t retryTimeoutInterval)
{
+ if (policy == nullptr)
+ {
+ BMCWEB_LOG_DEBUG("Retry policy was nullptr, ignoring set");
+ return;
+ }
policy->maxRetryAttempts = retryAttempts;
policy->retryIntervalSecs = std::chrono::seconds(retryTimeoutInterval);
}
diff --git a/test/http/server_sent_event_test.cpp b/test/http/server_sent_event_test.cpp
index 3e740cb525..74007797ef 100644
--- a/test/http/server_sent_event_test.cpp
+++ b/test/http/server_sent_event_test.cpp
@@ -34,7 +34,7 @@ TEST(ServerSentEvent, SseWorks)
std::shared_ptr<ConnectionImpl<boost::beast::test::stream>> conn =
std::make_shared<ConnectionImpl<boost::beast::test::stream>>(
- io, std::move(stream), openHandler, closeHandler);
+ std::move(stream), openHandler, closeHandler);
conn->start();
// Connect
{