Skip to content

Commit

Permalink
https://telecominfraproject.atlassian.net/browse/WIFI-13172
Browse files Browse the repository at this point in the history
Signed-off-by: stephb9959 <[email protected]>
  • Loading branch information
stephb9959 committed Dec 4, 2023
1 parent 13d2d39 commit a283f31
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4
5
2 changes: 0 additions & 2 deletions src/framework/EventBusManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

namespace OpenWifi {

EventBusManager::EventBusManager(Poco::Logger &L) : Logger_(L) {}

void EventBusManager::run() {
Running_ = true;
Utils::SetThreadName("fmwk:EventMgr");
Expand Down
12 changes: 12 additions & 0 deletions src/framework/EventBusManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ namespace OpenWifi {

class EventBusManager : public Poco::Runnable {
public:
EventBusManager() :
Logger_(Poco::Logger::create(
"EventBusManager", Poco::Logger::root().getChannel(), Poco::Logger::root().getLevel())) {
}

static auto instance() {
static auto instance_ = new EventBusManager;
return instance_;
}

explicit EventBusManager(Poco::Logger &L);
void run() final;
void Start();
Expand All @@ -24,4 +34,6 @@ namespace OpenWifi {
Poco::Logger &Logger_;
};

inline auto EventBusManager() { return EventBusManager::instance(); }

} // namespace OpenWifi
10 changes: 4 additions & 6 deletions src/framework/MicroService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ namespace OpenWifi {
const std::string &Payload) {
std::lock_guard G(InfraMutex_);

Poco::Logger &BusLogger = Poco::Logger::create(
"BusMessageReceived", Poco::Logger::root().getChannel(), Poco::Logger::root().getLevel());
Poco::Logger &BusLogger = EventBusManager()->Logger();

try {
Poco::JSON::Parser P;
auto Object = P.parse(Payload).extract<Poco::JSON::Object::Ptr>();
Expand Down Expand Up @@ -552,14 +552,12 @@ namespace OpenWifi {
for (auto i : SubSystems_) {
i->Start();
}
EventBusManager_ = std::make_unique<EventBusManager>(Poco::Logger::create(
"EventBusManager", Poco::Logger::root().getChannel(), Poco::Logger::root().getLevel()));
EventBusManager_->Start();
EventBusManager()->Start();
}

void MicroService::StopSubSystemServers() {
AddActivity("Stopping");
EventBusManager_->Stop();
EventBusManager()->Stop();
for (auto i = SubSystems_.rbegin(); i != SubSystems_.rend(); ++i) {
(*i)->Stop();
}
Expand Down
1 change: 0 additions & 1 deletion src/framework/MicroService.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ namespace OpenWifi {
Poco::JWT::Signer Signer_;
Poco::Logger &Logger_;
Poco::ThreadPool TimerPool_{"timer:pool", 2, 32};
std::unique_ptr<EventBusManager> EventBusManager_;
};

inline MicroService *MicroService::instance_ = nullptr;
Expand Down

0 comments on commit a283f31

Please sign in to comment.