aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/utils.cpp
diff options
context:
space:
mode:
authorGravatar attilamolnar2013-07-19 13:40:07 +0200
committerGravatar attilamolnar2013-08-22 13:42:20 +0200
commit7264a6a8d4360989ca2f64230da07c562d0f34f1 (patch)
treec2916ac67c8b547f234eb67206ccb7ced14e8860 /src/modules/m_spanningtree/utils.cpp
parentm_spanningtree Remove duplicate code for sending channel messages from RouteC... (diff)
m_spanningtree Add TreeServer::GetChildren() that replaces ChildCount() and GetChild()
Diffstat (limited to 'src/modules/m_spanningtree/utils.cpp')
-rw-r--r--src/modules/m_spanningtree/utils.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index bd87f2028..f71a9f0d5 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -136,14 +136,11 @@ SpanningTreeUtilities::SpanningTreeUtilities(ModuleSpanningTree* C)
CullResult SpanningTreeUtilities::cull()
{
- while (TreeRoot->ChildCount())
+ const TreeServer::ChildServers& children = TreeRoot->GetChildren();
+ while (!children.empty())
{
- TreeServer* child_server = TreeRoot->GetChild(0);
- if (child_server)
- {
- TreeSocket* sock = child_server->GetSocket();
- sock->Close();
- }
+ TreeSocket* sock = children.front()->GetSocket();
+ sock->Close();
}
for(std::map<TreeSocket*, std::pair<std::string, int> >::iterator i = timeoutlist.begin(); i != timeoutlist.end(); ++i)
@@ -209,10 +206,10 @@ void SpanningTreeUtilities::DoOneToAllButSender(const std::string& prefix, const
{
std::string FullLine = ConstructLine(prefix, command, params);
- unsigned int items = this->TreeRoot->ChildCount();
- for (unsigned int x = 0; x < items; x++)
+ const TreeServer::ChildServers& children = TreeRoot->GetChildren();
+ for (TreeServer::ChildServers::const_iterator i = children.begin(); i != children.end(); ++i)
{
- TreeServer* Route = this->TreeRoot->GetChild(x);
+ TreeServer* Route = *i;
// Send the line if the route isn't the path to the one to be omitted
if (Route != omitroute)
{