From cf2a8bd3858b054acf8e4dfef28c6be637f43f89 Mon Sep 17 00:00:00 2001 From: w00t Date: Fri, 4 Apr 2008 15:48:37 +0000 Subject: [PATCH] Attempt to avoid infinite loops git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9323 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_chanlog.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp index a5fcbe5bf..480d169d6 100644 --- a/src/modules/m_chanlog.cpp +++ b/src/modules/m_chanlog.cpp @@ -26,18 +26,24 @@ class ChannelLogStream : public LogStream virtual void OnLog(int loglevel, const std::string &type, const std::string &msg) { Channel *c = ServerInstance->FindChan(channel); + static bool Logging = false; printf("I got called\n"); if (loglevel < this->loglvl) return; + if (Logging) + return; + if (c) { + Logging = true; // this avoids (rare chance) loops with logging server IO on networks char buf[MAXBUF]; snprintf(buf, MAXBUF, "\2%s\2: %s", type.c_str(), msg.c_str()); c->WriteChannelWithServ(ServerInstance->Config->ServerName, "PRIVMSG %s :%s", c->name, buf); ServerInstance->PI->SendChannelPrivmsg(c, 0, buf); + Logging = false; } } }; -- 2.39.5