summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/treesocket1.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-04-26 16:51:41 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-04-26 16:51:41 +0000
commit37a53f1ac69315f1915aae67a447fb7b813e8217 (patch)
tree57c0367cce15e2f81fcab530f35bf343505cfeb8 /src/modules/m_spanningtree/treesocket1.cpp
parent225636f9d7aebe4556d1435fd6db04765f9a25cd (diff)
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
Diffstat (limited to 'src/modules/m_spanningtree/treesocket1.cpp')
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp12
1 files changed, 9 insertions, 3 deletions
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<std::string> &params)
{
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<std::string> &params)
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<std::string> &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++;