MCPcopy Create free account
hub / github.com/Icinga/icinga2 / Unsubscribe

Method Unsubscribe

lib/remote/eventqueue.cpp:294–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294void EventsRouter::Unsubscribe(const std::set<EventType>& types, const EventsInbox::Ptr& inbox)
295{
296 const auto& filter (inbox->GetFilter());
297 std::unique_lock<std::mutex> lock (m_Mutex);
298
299 for (auto type : types) {
300 auto perType (m_Subscribers.find(type));
301
302 if (perType != m_Subscribers.end()) {
303 auto perFilter (perType->second.find(filter));
304
305 if (perFilter != perType->second.end()) {
306 perFilter->second.erase(inbox);
307
308 if (perFilter->second.empty()) {
309 perType->second.erase(perFilter);
310 }
311 }
312
313 if (perType->second.empty()) {
314 m_Subscribers.erase(perType);
315 }
316 }
317 }
318}
319
320EventsFilter EventsRouter::GetInboxes(EventType type)
321{

Callers 1

~EventsSubscriberMethod · 0.80

Calls 4

findMethod · 0.80
endMethod · 0.45
eraseMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected