From c66e272f93d97ebe4c730814f5058d65481e45c6 Mon Sep 17 00:00:00 2001 From: danieldg Date: Thu, 4 Feb 2010 00:47:40 +0000 Subject: 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 --- src/modules/m_spanningtree/treesocket.h | 5 +++-- src/modules/m_spanningtree/treesocket1.cpp | 4 +++- src/modules/m_spanningtree/treesocket2.cpp | 2 ++ 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; } } -- cgit v1.2.3