From 520401ed4a472f062f3e4bcef038905169f53c17 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sun, 19 Apr 2009 15:26:21 +0000 Subject: Add loopCall to prevent double-broadcasting new X:lines git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11319 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/main.cpp | 2 +- src/modules/m_spanningtree/main.h | 4 ++++ src/modules/m_spanningtree/treesocket1.cpp | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 0a6ed9390..aabdba2bb 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -769,7 +769,7 @@ void ModuleSpanningTree::OnOper(User* user, const std::string &opertype) void ModuleSpanningTree::OnAddLine(User* user, XLine *x) { - if (!x->IsBurstable()) + if (!x->IsBurstable() || loopCall) return; char data[MAXBUF]; diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index bac4f94a8..5333b64d4 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -51,6 +51,10 @@ class ModuleSpanningTree : public Module public: CacheRefreshTimer *RefreshTimer; + /** Set to true if inside a spanningtree call, to prevent sending + * xlines and other things back to their source + */ + bool loopCall; /** Constructor */ diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index b34335b01..12272d3b8 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -259,6 +259,7 @@ bool TreeSocket::OnDataReady() if (data && *data) { this->in_buffer.append(data); + Utils->Creator->loopCall = true; /* While there is at least one new line in the buffer, * do something useful (we hope!) with it. */ @@ -280,6 +281,7 @@ bool TreeSocket::OnDataReady() return false; } } + Utils->Creator->loopCall = false; return true; } /* EAGAIN returns an empty but non-NULL string, so this -- cgit v1.2.3