From 37a53f1ac69315f1915aae67a447fb7b813e8217 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 26 Apr 2007 16:51:41 +0000 Subject: Make error reporting work properly, it seemed to loose errors. First change: Add a culling list of inspsockets waiting to be closed, so the close() is less likely to be called before the buffer is entirely empty. This seems to work well on my LAN. Second change: Add a SendError() method, rather than WriteLine("ERROR : ..."). This can be used to effect by also echoing out "Sent ERROR to %s: ..." onto the +l snomask meaning at least one end will always see the error even if the ERROR command is lost due to latency or design of the transport (e.g. ssl which may be writing during a read event etc) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6844 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/treesocket1.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/modules/m_spanningtree/treesocket1.cpp') diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 21d6b912f..a05ed6e4c 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -373,11 +373,17 @@ std::string TreeSocket::ListDifference(const std::string &one, const std::string return result; } +void TreeSocket::SendError(const std::string &errormessage) +{ + this->WriteLine("ERROR :"+errormessage); + this->Instance->SNO->WriteToSnoMask('l',"Sent \2ERROR\2 to "+this->InboundServerName+": "+errormessage); +} + bool TreeSocket::Capab(const std::deque ¶ms) { if (params.size() < 1) { - this->WriteLine("ERROR :Invalid number of parameters for CAPAB - Mismatched version"); + this->SendError("Invalid number of parameters for CAPAB - Mismatched version"); return false; } if (params[0] == "START") @@ -467,7 +473,7 @@ bool TreeSocket::Capab(const std::deque ¶ms) if (reason.length()) { - this->WriteLine("ERROR :CAPAB negotiation failed: "+reason); + this->SendError("CAPAB negotiation failed: "+reason); return false; } } @@ -843,7 +849,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque &p * danger bill bobbertson! (that's will robinsons older brother ;-) ...) */ this->Instance->WriteOpers("ERROR: We received a user with an unknown prefix '%c'. Closed connection to avoid a desync.",*permissions); - this->WriteLine(std::string("ERROR :Invalid prefix '")+(*permissions)+"' in FJOIN"); + this->SendError(std::string("Invalid prefix '")+(*permissions)+"' in FJOIN"); return false; } usr++; -- cgit v1.3.1-10-gc9f91