summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-04 00:47:40 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-04 00:47:40 +0000
commitc66e272f93d97ebe4c730814f5058d65481e45c6 (patch)
tree3f5d2492b2bc2108bd1383c2a0a7d8569945c170 /src/modules/m_spanningtree
parentc7c29d03e204473f82cdf2f33f8d24b83b61ed63 (diff)
Add DYING link state, push error messages on link, and only limit recvq on unauthenticated servers
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12370 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/treesocket.h5
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp4
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp2
3 files changed, 8 insertions, 3 deletions
diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h
index 1bd02762d..4438b473d 100644
--- a/src/modules/m_spanningtree/treesocket.h
+++ b/src/modules/m_spanningtree/treesocket.h
@@ -49,10 +49,11 @@
* WAIT_AUTH_2: indicates that the socket is inbound
* but has not yet sent and received
* SERVER strings.
- * CONNECTED: represents a fully authorized, fully
+ * CONNECTED: represents a fully authorized, fully
* connected server.
+ * DYING: represents a server that has had an error.
*/
-enum ServerState { CONNECTING, WAIT_AUTH_1, WAIT_AUTH_2, CONNECTED };
+enum ServerState { CONNECTING, WAIT_AUTH_1, WAIT_AUTH_2, CONNECTED, DYING };
struct CapabData
{
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index 23d1e46cd..ea87c615f 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -143,6 +143,8 @@ void TreeSocket::OnError(BufferedSocketError e)
void TreeSocket::SendError(const std::string &errormessage)
{
WriteLine("ERROR :"+errormessage);
+ DoWrite();
+ LinkState = DYING;
SetError(errormessage);
}
@@ -233,7 +235,7 @@ void TreeSocket::OnDataReady()
if (!getError().empty())
break;
}
- if (getError().empty() && recvq.length() > 4096)
+ if (LinkState != CONNECTED && recvq.length() > 4096)
SendError("RecvQ overrun (line too long)");
Utils->Creator->loopCall = false;
}
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 3f63da03d..aacbbc25f 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -219,6 +219,8 @@ void TreeSocket::ProcessLine(std::string &line)
*/
this->ProcessConnectedLine(prefix, command, params);
break;
+ case DYING:
+ break;
}
}