From 61ca40fa0e6c819aa72f3f2364667c7b990855d4 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Thu, 20 Feb 2014 02:31:16 +0100 Subject: Delete empty bridges objects --- src/xmpp/xmpp_component.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/xmpp') diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp index 2fb8a23..e059764 100644 --- a/src/xmpp/xmpp_component.cpp +++ b/src/xmpp/xmpp_component.cpp @@ -99,9 +99,14 @@ void XmppComponent::shutdown() void XmppComponent::clean() { - for (auto it = this->bridges.begin(); it != this->bridges.end(); ++it) + auto it = this->bridges.begin(); + while (it != this->bridges.end()) { it->second->clean(); + if (it->second->connected_clients() == 0) + it = this->bridges.erase(it); + else + ++it; } } -- cgit v1.2.3