diff options
Diffstat (limited to 'redfish-core/include/event_service_manager.hpp')
-rw-r--r-- | redfish-core/include/event_service_manager.hpp | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp index 702ca268fd..ba2450d6dd 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -60,7 +60,6 @@ static constexpr const char* eventServiceFile = static constexpr const uint8_t maxNoOfSubscriptions = 20; static constexpr const uint8_t maxNoOfSSESubscriptions = 10; -#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) static std::optional<boost::asio::posix::stream_descriptor> inotifyConn; static constexpr const char* redfishEventLogDir = "/var/log"; @@ -258,7 +257,6 @@ inline int formatEventLogEntry(const std::string& logEntryID, } } // namespace event_log -#endif inline bool isFilterQuerySpecialChar(char c) { @@ -426,7 +424,6 @@ class Subscription : public persistent_data::UserSubscription return sendEvent(std::move(strMsg)); } -#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES void filterAndSendEventLogs( const std::vector<EventLogObjectsType>& eventRecords) { @@ -492,7 +489,6 @@ class Subscription : public persistent_data::UserSubscription sendEvent(std::move(strMsg)); eventSeqNum++; } -#endif void filterAndSendReports(const std::string& reportId, const telemetry::TimestampReadings& var) @@ -682,11 +678,11 @@ class EventServiceManager updateNoOfSubscribersCount(); -#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES - - cacheRedfishLogFile(); + if constexpr (!BMCWEB_REDFISH_DBUS_LOG) + { + cacheRedfishLogFile(); + } -#endif // Update retry configuration. subValue->updateRetryConfig(retryAttempts, retryTimeoutInterval); } @@ -942,12 +938,13 @@ class EventServiceManager updateSubscriptionData(); } -#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES - if (redfishLogFilePosition != 0) + if constexpr (!BMCWEB_REDFISH_DBUS_LOG) { - cacheRedfishLogFile(); + if (redfishLogFilePosition != 0) + { + cacheRedfishLogFile(); + } } -#endif // Update retry configuration. subValue->updateRetryConfig(retryAttempts, retryTimeoutInterval); @@ -979,17 +976,19 @@ class EventServiceManager void deleteSseSubscription(const crow::sse_socket::Connection& thisConn) { - for (const auto& it : subscriptionsMap) + for (auto it = subscriptionsMap.begin(); it != subscriptionsMap.end();) { - std::shared_ptr<Subscription> entry = it.second; + std::shared_ptr<Subscription> entry = it->second; bool entryIsThisConn = entry->matchSseId(thisConn); if (entryIsThisConn) { persistent_data::EventServiceStore::getInstance() .subscriptionsConfigMap.erase( - it.second->getSubscriptionId()); + it->second->getSubscriptionId()); + it = subscriptionsMap.erase(it); return; } + it++; } } @@ -1097,8 +1096,6 @@ class EventServiceManager } } -#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES - void resetRedfishFilePosition() { // Control would be here when Redfish file is created. @@ -1336,7 +1333,6 @@ class EventServiceManager return 0; } -#endif static void getReadingsForReport(sdbusplus::message_t& msg) { if (msg.is_method_error()) |