summaryrefslogtreecommitdiff
path: root/src/xmpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-02-20 02:31:16 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-02-20 02:31:16 +0100
commit61ca40fa0e6c819aa72f3f2364667c7b990855d4 (patch)
treea3cb056d886529a5ea145d43d2bc93845a38e9d1 /src/xmpp
parent190c4ff1762e5e762e913f98033369ed75ed5291 (diff)
downloadbiboumi-61ca40fa0e6c819aa72f3f2364667c7b990855d4.tar.gz
biboumi-61ca40fa0e6c819aa72f3f2364667c7b990855d4.tar.bz2
biboumi-61ca40fa0e6c819aa72f3f2364667c7b990855d4.tar.xz
biboumi-61ca40fa0e6c819aa72f3f2364667c7b990855d4.zip
Delete empty bridges objects
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/xmpp_component.cpp7
1 files changed, 6 insertions, 1 deletions
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;
}
}